Skip to content

Commit

Permalink
doc: correct checkHost behavior with wildcards etc
Browse files Browse the repository at this point in the history
The current documentation is inaccurate in that checkHost does not
necessarily return the given host name, but instead returns the subject
name that matched the given host name.

Refs: nodejs#36804

PR-URL: nodejs#41468
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
  • Loading branch information
tniessen authored and mawaregetsuka committed Jan 17, 2022
1 parent 003cea3 commit bd2b3c3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions doc/api/crypto.md
Expand Up @@ -2498,11 +2498,17 @@ added: v15.6.0
* `partialWildcards` {boolean} **Default:** `true`.
* `multiLabelWildcards` {boolean} **Default:** `false`.
* `singleLabelSubdomains` {boolean} **Default:** `false`.
* Returns: {string|undefined} Returns `name` if the certificate matches,
`undefined` if it does not.
* Returns: {string|undefined} Returns a subject name that matches `name`,
or `undefined` if no subject name matches `name`.

Checks whether the certificate matches the given host name.

If the certificate matches the given host name, the matching subject name is
returned. The returned name might be an exact match (e.g., `foo.example.com`)
or it might contain wildcards (e.g., `*.example.com`). Because host name
comparisons are case-insensitive, the returned subject name might also differ
from the given `name` in capitalization.

### `x509.checkIP(ip[, options])`

<!-- YAML
Expand Down

0 comments on commit bd2b3c3

Please sign in to comment.