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 <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Sam Roberts 2018-11-06 09:58:42 -08:00 committed by Rich Trott
parent 6727f1c787
commit 3833d69936
3 changed files with 11 additions and 10 deletions

View File

@ -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 been initialized. This can contain useful information that can vary based on
the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type, the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type,
`resource` provides the hostname used when looking up the IP address for the `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 currently not considered public, but using the Embedder API, users can provide
and document their own resource objects. For example, such a resource object and document their own resource objects. For example, such a resource object
could contain the SQL query being executed. could contain the SQL query being executed.

View File

@ -368,7 +368,7 @@ proxy.listen(1337, '127.0.0.1', () => {
// make a request to a tunneling proxy // make a request to a tunneling proxy
const options = { const options = {
port: 1337, port: 1337,
hostname: '127.0.0.1', host: '127.0.0.1',
method: 'CONNECT', method: 'CONNECT',
path: 'www.google.com:80' 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 http = require('http');
const options = { const options = {
hostname: '127.0.0.1', host: '127.0.0.1',
port: 8080, port: 8080,
path: '/length_request' path: '/length_request'
}; };
@ -502,7 +502,7 @@ srv.listen(1337, '127.0.0.1', () => {
// make a request // make a request
const options = { const options = {
port: 1337, port: 1337,
hostname: '127.0.0.1', host: '127.0.0.1',
headers: { headers: {
'Connection': 'Upgrade', 'Connection': 'Upgrade',
'Upgrade': 'websocket' 'Upgrade': 'websocket'
@ -1898,14 +1898,14 @@ changes:
* `host` {string} A domain name or IP address of the server to issue the * `host` {string} A domain name or IP address of the server to issue the
request to. **Default:** `'localhost'`. request to. **Default:** `'localhost'`.
* `hostname` {string} Alias for `host`. To support [`url.parse()`][], * `hostname` {string} Alias for `host`. To support [`url.parse()`][],
`hostname` is preferred over `host`. `hostname` will be used if both `host` and `hostname` are specified.
* `family` {number} IP address family to use when resolving `host` and * `family` {number} IP address family to use when resolving `host` or
`hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and
v6 will be used. v6 will be used.
* `port` {number} Port of remote server. **Default:** `80`. * `port` {number} Port of remote server. **Default:** `80`.
* `localAddress` {string} Local interface to bind for network connections. * `localAddress` {string} Local interface to bind for network connections.
* `socketPath` {string} Unix Domain Socket (use one of `host:port` or * `socketPath` {string} Unix Domain Socket (cannot be used if one of `host`
`socketPath`). or `port` is specified, those specify a TCP Socket).
* `method` {string} A string specifying the HTTP request method. **Default:** * `method` {string} A string specifying the HTTP request method. **Default:**
`'GET'`. `'GET'`.
* `path` {string} Request path. Should include query string if any. * `path` {string} Request path. Should include query string if any.

View File

@ -811,14 +811,15 @@ decrease overall server throughput.
added: v0.8.4 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 * `cert` {Object} An object representing the peer's certificate. The returned
object has some properties corresponding to the fields of the certificate. object has some properties corresponding to the fields of the certificate.
* Returns: {Error|undefined} * Returns: {Error|undefined}
Verifies the certificate `cert` is issued to `hostname`. 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}. failure. On success, returns {undefined}.
This function can be overwritten by providing alternative function as part of This function can be overwritten by providing alternative function as part of