-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: Improve checkServerIdentity docs #17203
Conversation
See also #11467 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me with one requested change. Thanks for the pull request!
doc/api/tls.md
Outdated
@@ -792,8 +792,9 @@ changes: | |||
* `servername`: {string} Server name for the SNI (Server Name Indication) TLS | |||
extension. | |||
* `checkServerIdentity(servername, cert)` {Function} A callback function | |||
to be used when checking the server's hostname against the certificate. | |||
This should throw an error if verification fails. The method should return | |||
to be used (instead of the builtin {tls.checkServerIdentity} function) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please change this line to this?:
to be used instead of
tls.checkServerIdentity()
Backticks are appropriate here. Curly braces are for types. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. That makes sense. Thanks for the comment!
Fixed :)
4bf98c7
to
ea0cd07
Compare
doc/api/tls.md
Outdated
@@ -792,8 +792,9 @@ changes: | |||
* `servername`: {string} Server name for the SNI (Server Name Indication) TLS | |||
extension. | |||
* `checkServerIdentity(servername, cert)` {Function} A callback function | |||
to be used when checking the server's hostname against the certificate. | |||
This should throw an error if verification fails. The method should return | |||
to be used (instead of the builtin `tls.checkServerIdentity` function) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit: can you use tls.checkServerIdentity()
? It seems to be the dominant style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course! :) Updated
ea0cd07
to
15a4b95
Compare
Probably a dumb question, I'm new around here =): What makes those export more public then say https://github.com/nodejs/node/blob/master/lib/tls.js#L168 ? If thats purely source code readability, should I document the checkServerIdentity function? |
@Hannes-Magnusson-CK The comment is a bit misguided / misleading, it should just be removed. You could read it as "these are the public and documented APIs" but some of the exports elsewhere are mentioned in the docs too, if only in passing. |
Ok. Thanks @bnoordhuis ! |
The funciton was added in eb2ca10
Added a commit documenting |
@@ -236,7 +236,6 @@ exports.parseCertString = internalUtil.deprecate( | |||
'Please use querystring.parse() instead.', | |||
'DEP0076'); | |||
|
|||
// Public API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a misleading comment. These aren't the only exported functions.
PR-URL: #17203 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #17203 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #17203 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #17203 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #17203 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: #17203 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Checklist
Affected core subsystem(s)
tls doc