Skip to content

Commit 5c0c459

Browse files
tniessentargos
authored andcommitted
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: #36804 PR-URL: #41468 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
1 parent 258ee4b commit 5c0c459

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/api/crypto.md

+8-2
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 contain wildcards (e.g., `*.example.com`). Because host name
2509+
comparisons are case-insensitive, the returned subject name might also differ
2510+
from the given `name` in capitalization.
2511+
25062512
### `x509.checkIP(ip[, options])`
25072513

25082514
<!-- YAML

0 commit comments

Comments
 (0)