Skip to content

Commit 9e230a6

Browse files
committed
doc: correct checkHost behavior with wildcards etc
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
1 parent c4194c0 commit 9e230a6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/api/crypto.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,11 +2498,17 @@ added: v15.6.0
24982498
* `partialWildcards` {boolean} **Default:** `true`.
24992499
* `multiLabelWildcards` {boolean} **Default:** `false`.
25002500
* `singleLabelSubdomains` {boolean} **Default:** `false`.
2501-
* Returns: {string|undefined} Returns `name` if the certificate matches,
2502-
`undefined` if it does not.
2501+
* Returns: {string|undefined} Returns a subject name that matches `name`,
2502+
or `undefined` if no subject name matches `name`.
25032503

25042504
Checks whether the certificate matches the given host name.
25052505

2506+
If the certificate matches the given host name, the matching subject name is
2507+
returned. The returned name might be an exact match (e.g., `foo.example.com`)
2508+
or it might be a wildcard (e.g., `*.example.com`). Because host name comparisons
2509+
are case-insensitive, exact matches and wildcards might differ from the given
2510+
`name` in capitalization.
2511+
25062512
### `x509.checkIP(ip[, options])`
25072513

25082514
<!-- YAML

0 commit comments

Comments
 (0)