From 3833d69936ada7e1e1a68dc73dd31d31423fbbaf Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 6 Nov 2018 09:58:42 -0800 Subject: [PATCH] doc: fix some inconsistent use of hostname host names are DNS names, host addresses are IP addresses, and `host` arguments and options can be either. PR-URL: https://github.com/nodejs/node/pull/24199 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- doc/api/async_hooks.md | 2 +- doc/api/http.md | 14 +++++++------- doc/api/tls.md | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index b208dffb77db78..4d0494d7812538 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -296,7 +296,7 @@ of propagating what resource is responsible for the new resource's existence. been initialized. This can contain useful information that can vary based on the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type, `resource` provides the hostname used when looking up the IP address for the -hostname in `net.Server.listen()`. The API for accessing this information is +host in `net.Server.listen()`. The API for accessing this information is currently not considered public, but using the Embedder API, users can provide and document their own resource objects. For example, such a resource object could contain the SQL query being executed. diff --git a/doc/api/http.md b/doc/api/http.md index ff948cd9f5d6a6..4f526b36aaea8e 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -368,7 +368,7 @@ proxy.listen(1337, '127.0.0.1', () => { // make a request to a tunneling proxy const options = { port: 1337, - hostname: '127.0.0.1', + host: '127.0.0.1', method: 'CONNECT', path: 'www.google.com:80' }; @@ -415,7 +415,7 @@ event is emitted with a callback containing an object with a status code. const http = require('http'); const options = { - hostname: '127.0.0.1', + host: '127.0.0.1', port: 8080, path: '/length_request' }; @@ -502,7 +502,7 @@ srv.listen(1337, '127.0.0.1', () => { // make a request const options = { port: 1337, - hostname: '127.0.0.1', + host: '127.0.0.1', headers: { 'Connection': 'Upgrade', 'Upgrade': 'websocket' @@ -1898,14 +1898,14 @@ changes: * `host` {string} A domain name or IP address of the server to issue the request to. **Default:** `'localhost'`. * `hostname` {string} Alias for `host`. To support [`url.parse()`][], - `hostname` is preferred over `host`. - * `family` {number} IP address family to use when resolving `host` and + `hostname` will be used if both `host` and `hostname` are specified. + * `family` {number} IP address family to use when resolving `host` or `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be used. * `port` {number} Port of remote server. **Default:** `80`. * `localAddress` {string} Local interface to bind for network connections. - * `socketPath` {string} Unix Domain Socket (use one of `host:port` or - `socketPath`). + * `socketPath` {string} Unix Domain Socket (cannot be used if one of `host` + or `port` is specified, those specify a TCP Socket). * `method` {string} A string specifying the HTTP request method. **Default:** `'GET'`. * `path` {string} Request path. Should include query string if any. diff --git a/doc/api/tls.md b/doc/api/tls.md index b562c11b368544..31ad74a6ce8d1f 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -811,14 +811,15 @@ decrease overall server throughput. added: v0.8.4 --> -* `hostname` {string} The hostname to verify the certificate against +* `hostname` {string} The host name or IP address to verify the certificate + against. * `cert` {Object} An object representing the peer's certificate. The returned object has some properties corresponding to the fields of the certificate. * Returns: {Error|undefined} Verifies the certificate `cert` is issued to `hostname`. -Returns {Error} object, populating it with the reason, host, and cert on +Returns {Error} object, populating it with `reason`, `host`, and `cert` on failure. On success, returns {undefined}. This function can be overwritten by providing alternative function as part of