Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fdc072b

Browse filesBrowse files
mgjmgibfahn
authored andcommitted
doc: fix inconsistent server.listen documentation
The `net`, `tls`, `http` and `https` module have the same `server.listen()` method, but have a different documenation. Changed to a consistent link to the documentation of the `net` module. PR-URL: #16020 Backport-PR-URL: #16435 Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 6be4942 commit fdc072b
Copy full SHA for fdc072b

File tree

Expand file treeCollapse file tree

3 files changed

+23
-119
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+23
-119
lines changed
Open diff view settings
Collapse file

‎doc/api/http.md‎

Copy file name to clipboardExpand all lines: doc/api/http.md
+4-75Lines changed: 4 additions & 75 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -841,82 +841,10 @@ added: v0.1.90
841841

842842
Stops the server from accepting new connections. See [`net.Server.close()`][].
843843

844-
### server.listen(handle[, callback])
845-
<!-- YAML
846-
added: v0.5.10
847-
-->
848-
849-
* `handle` {Object}
850-
* `callback` {Function}
851-
852-
The `handle` object can be set to either a server or socket (anything
853-
with an underlying `_handle` member), or a `{fd: <n>}` object.
854-
855-
This will cause the server to accept connections on the specified
856-
handle, but it is presumed that the file descriptor or handle has
857-
already been bound to a port or domain socket.
858-
859-
Listening on a file descriptor is not supported on Windows.
860-
861-
This function is asynchronous. `callback` will be added as a listener for the
862-
[`'listening'`][] event. See also [`net.Server.listen()`][].
863-
864-
Returns `server`.
865-
866-
*Note*: The `server.listen()` method may be called multiple times. Each
867-
subsequent call will *re-open* the server using the provided options.
868-
869-
### server.listen(path[, callback])
870-
<!-- YAML
871-
added: v0.1.90
872-
-->
873-
874-
* `path` {string}
875-
* `callback` {Function}
876-
877-
Start a UNIX socket server listening for connections on the given `path`.
878-
879-
This function is asynchronous. `callback` will be added as a listener for the
880-
[`'listening'`][] event. See also [`net.Server.listen(path)`][].
881-
882-
*Note*: The `server.listen()` method may be called multiple times. Each
883-
subsequent call will *re-open* the server using the provided options.
884-
885-
### server.listen([port][, hostname][, backlog][, callback])
886-
<!-- YAML
887-
added: v0.1.90
888-
-->
889-
890-
* `port` {number}
891-
* `hostname` {string}
892-
* `backlog` {number}
893-
* `callback` {Function}
894-
895-
Begin accepting connections on the specified `port` and `hostname`. If the
896-
`hostname` is omitted, the server will accept connections on the
897-
[unspecified IPv6 address][] (`::`) when IPv6 is available, or the
898-
[unspecified IPv4 address][] (`0.0.0.0`) otherwise.
899-
900-
*Note*: In most operating systems, listening to the
901-
[unspecified IPv6 address][] (`::`) may cause the `net.Server` to also listen on
902-
the [unspecified IPv4 address][] (`0.0.0.0`).
903-
904-
Omit the port argument, or use a port value of `0`, to have the operating system
905-
assign a random port, which can be retrieved by using `server.address().port`
906-
after the `'listening'` event has been emitted.
907-
908-
To listen to a unix socket, supply a filename instead of port and hostname.
909-
910-
`backlog` is the maximum length of the queue of pending connections.
911-
The actual length will be determined by the OS through sysctl settings such as
912-
`tcp_max_syn_backlog` and `somaxconn` on linux. The default value of this
913-
parameter is 511 (not 512).
914-
915-
This function is asynchronous. `callback` will be added as a listener for the
916-
[`'listening'`][] event. See also [`net.Server.listen(port)`][].
844+
### server.listen()
917845

918-
*Note*: The `server.listen()` method may be called multiple times. Each
919-
subsequent call will *re-open* the server using the provided options.
846+
Starts the HTTP server listening for connections.
847+
This method is identical to [`server.listen()`][] from [`net.Server`][].
920848

921849
### server.listening
922850
<!-- YAML
@@ -1971,6 +1899,7 @@ const req = http.request(options, (res) => {
19711899
[`response.write(data, encoding)`]: #http_response_write_chunk_encoding_callback
19721900
[`response.writeContinue()`]: #http_response_writecontinue
19731901
[`response.writeHead()`]: #http_response_writehead_statuscode_statusmessage_headers
1902+
[`server.listen()`]: net.html#net_server_listen
19741903
[`server.timeout`]: #http_server_timeout
19751904
[`setHeader(name, value)`]: #http_request_setheader_name_value
19761905
[`socket.setKeepAlive()`]: net.html#net_socket_setkeepalive_enable_initialdelay
Collapse file

‎doc/api/https.md‎

Copy file name to clipboardExpand all lines: doc/api/https.md
+15-24Lines changed: 15 additions & 24 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ added: v0.3.4
2323
This class is a subclass of `tls.Server` and emits events same as
2424
[`http.Server`][]. See [`http.Server`][] for more information.
2525

26+
### server.close([callback])
27+
<!-- YAML
28+
added: v0.1.90
29+
-->
30+
- `callback` {Function}
31+
32+
See [`server.close()`][`http.close()`] from the HTTP module for details.
33+
34+
### server.listen()
35+
36+
Starts the HTTPS server listening for encrypted connections.
37+
This method is identical to [`server.listen()`][] from [`net.Server`][].
38+
2639
### server.setTimeout([msecs][, callback])
2740
<!-- YAML
2841
added: v0.11.2
@@ -90,30 +103,6 @@ https.createServer(options, (req, res) => {
90103
}).listen(8000);
91104
```
92105

93-
### server.close([callback])
94-
<!-- YAML
95-
added: v0.1.90
96-
-->
97-
- `callback` {Function}
98-
99-
See [`http.close()`][] for details.
100-
101-
### server.listen(handle[, callback])
102-
- `handle` {Object}
103-
- `callback` {Function}
104-
105-
### server.listen(path[, callback])
106-
- `path` {string}
107-
- `callback` {Function}
108-
109-
### server.listen([port][, host][, backlog][, callback])
110-
- `port` {number}
111-
- `hostname` {string}
112-
- `backlog` {number}
113-
- `callback` {Function}
114-
115-
See [`http.listen()`][] for details.
116-
117106
## https.get(options[, callback])
118107
<!-- YAML
119108
added: v0.3.6
@@ -271,6 +260,8 @@ const req = https.request(options, (res) => {
271260
[`http.request()`]: http.html#http_http_request_options_callback
272261
[`https.Agent`]: #https_class_https_agent
273262
[`https.request()`]: #https_https_request_options_callback
263+
[`net.Server`]: net.html#net_class_net_server
264+
[`server.listen()`]: net.html#net_server_listen
274265
[`tls.connect()`]: tls.html#tls_tls_connect_options_callback
275266
[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options
276267
[`tls.createServer()`]: tls.html#tls_tls_createserver_options_secureconnectionlistener
Collapse file

‎doc/api/tls.md‎

Copy file name to clipboardExpand all lines: doc/api/tls.md
+4-20Lines changed: 4 additions & 20 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -408,27 +408,10 @@ added: v3.0.0
408408
Returns a `Buffer` instance holding the keys currently used for
409409
encryption/decryption of the [TLS Session Tickets][]
410410

411-
### server.listen(port[, hostname][, callback])
412-
<!-- YAML
413-
added: v0.3.2
414-
-->
415-
416-
* `port` {number} The TCP/IP port on which to begin listening for connections.
417-
A value of `0` (zero) will assign a random port.
418-
* `hostname` {string} The hostname, IPv4, or IPv6 address on which to begin
419-
listening for connections. If `undefined`, the server will accept connections
420-
on any IPv6 address (`::`) when IPv6 is available, or any IPv4 address
421-
(`0.0.0.0`) otherwise.
422-
* `callback` {Function} A callback function to be invoked when the server has
423-
begun listening on the `port` and `hostname`.
424-
425-
The `server.listen()` methods instructs the server to begin accepting
426-
connections on the specified `port` and `hostname`.
427-
428-
This function operates asynchronously. If the `callback` is given, it will be
429-
called when the server has started listening.
411+
### server.listen()
430412

431-
See [`net.Server`][] for more information.
413+
Starts the server listening for encrypted connections.
414+
This method is identical to [`server.listen()`][] from [`net.Server`][].
432415

433416
### server.setTicketKeys(keys)
434417
<!-- YAML
@@ -1292,6 +1275,7 @@ where `secure_socket` has the same API as `pair.cleartext`.
12921275
[`net.Server`]: net.html#net_class_net_server
12931276
[`net.Socket`]: net.html#net_class_net_socket
12941277
[`server.getConnections()`]: net.html#net_server_getconnections_callback
1278+
[`server.listen()`]: net.html#net_server_listen
12951279
[`tls.DEFAULT_ECDH_CURVE`]: #tls_tls_default_ecdh_curve
12961280
[`tls.TLSSocket.getPeerCertificate()`]: #tls_tlssocket_getpeercertificate_detailed
12971281
[`tls.TLSSocket`]: #tls_class_tls_tlssocket

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.