-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: update http.md mention of socket #30155
Changes from 9 commits
55e6663
9eb3fac
8572afb
863f6f4
d49e4dd
38171e9
094d513
e54b9e9
2eec64c
5b827a3
fce5f9c
7cf2e18
da4eec8
d08c71e
352fce8
916b271
8f39b79
f1419f3
92bbaec
b545157
220cecb
92fbdef
6809c26
14cf7aa
1fc5adf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,13 +341,17 @@ added: v0.7.0 | |
--> | ||
|
||
* `response` {http.IncomingMessage} | ||
* `socket` {net.Socket} | ||
* `duplex` {stream.Duplex} | ||
* `head` {Buffer} | ||
|
||
Emitted each time a server responds to a request with a `CONNECT` method. If | ||
this event is not being listened for, clients receiving a `CONNECT` method will | ||
have their connections closed. | ||
|
||
This event is guaranteed to be passed an instance of the {net.Socket} class, | ||
a subclass of Duplex, instead of Duplex unless the user specifies a socket | ||
jessekoconnor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type other than {net.Socket}. | ||
|
||
A client and server pair demonstrating how to listen for the `'connect'` event: | ||
|
||
```js | ||
|
@@ -471,9 +475,11 @@ once. | |
added: v0.5.3 | ||
--> | ||
|
||
* `socket` {net.Socket} | ||
* `duplex` {stream.Duplex} | ||
|
||
Emitted after a socket is assigned to this request. | ||
This event is guaranteed to be passed an instance of the {net.Socket} class, | ||
a subclass of Duplex, instead of Duplex unless the user specifies a socket | ||
jessekoconnor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type other than {net.Socket}. | ||
|
||
### Event: 'timeout' | ||
<!-- YAML | ||
|
@@ -491,14 +497,18 @@ added: v0.1.94 | |
--> | ||
|
||
* `response` {http.IncomingMessage} | ||
* `socket` {net.Socket} | ||
* `duplex` {stream.Duplex} | ||
* `head` {Buffer} | ||
|
||
Emitted each time a server responds to a request with an upgrade. If this | ||
event is not being listened for and the response status code is 101 Switching | ||
Protocols, clients receiving an upgrade header will have their connections | ||
closed. | ||
|
||
This event is guaranteed to be passed an instance of the {net.Socket} class, | ||
a subclass of Duplex, instead of Duplex unless the user specifies a socket | ||
jessekoconnor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type other than {net.Socket}. | ||
|
||
A client server pair demonstrating how to listen for the `'upgrade'` event. | ||
|
||
```js | ||
|
@@ -935,13 +945,17 @@ changes: | |
--> | ||
|
||
* `exception` {Error} | ||
* `socket` {net.Socket} | ||
* `duplex` {stream.Duplex} | ||
|
||
If a client connection emits an `'error'` event, it will be forwarded here. | ||
Listener of this event is responsible for closing/destroying the underlying | ||
socket. For example, one may wish to more gracefully close the socket with a | ||
custom HTTP response instead of abruptly severing the connection. | ||
|
||
This event is guaranteed to be passed an instance of the {net.Socket} class, | ||
a subclass of Duplex, instead of Duplex unless the user specifies a socket | ||
jessekoconnor marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line should be changed, see my previous comments. |
||
type other than {net.Socket}. | ||
|
||
Default behavior is to try close the socket with a HTTP '400 Bad Request', | ||
or a HTTP '431 Request Header Fields Too Large' in the case of a | ||
[`HPE_HEADER_OVERFLOW`][] error. If the socket is not writable it is | ||
|
@@ -986,13 +1000,17 @@ added: v0.7.0 | |
|
||
* `request` {http.IncomingMessage} Arguments for the HTTP request, as it is in | ||
the [`'request'`][] event | ||
* `socket` {net.Socket} Network socket between the server and client | ||
* `duplex` {stream.Duplex} Network socket between the server and client | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer not to change the name of the argument. |
||
* `head` {Buffer} The first packet of the tunneling stream (may be empty) | ||
|
||
Emitted each time a client requests an HTTP `CONNECT` method. If this event is | ||
not listened for, then clients requesting a `CONNECT` method will have their | ||
connections closed. | ||
|
||
This event is guaranteed to be passed an instance of the {net.Socket} class, | ||
a subclass of Duplex, instead of Duplex unless the user specifies a socket | ||
jessekoconnor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type other than {net.Socket}. | ||
|
||
After this event is emitted, the request's socket will not have a `'data'` | ||
event listener, meaning it will need to be bound in order to handle data | ||
sent to the server on that socket. | ||
|
@@ -1002,7 +1020,7 @@ sent to the server on that socket. | |
added: v0.1.0 | ||
--> | ||
|
||
* `socket` {net.Socket} | ||
* `duplex` {stream.Duplex} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
||
This event is emitted when a new TCP stream is established. `socket` is | ||
typically an object of type [`net.Socket`][]. Usually users will not want to | ||
|
@@ -1017,6 +1035,10 @@ If `socket.setTimeout()` is called here, the timeout will be replaced with | |
`server.keepAliveTimeout` when the socket has served a request (if | ||
`server.keepAliveTimeout` is non-zero). | ||
|
||
This event is guaranteed to be passed an instance of the {net.Socket} class, | ||
a subclass of Duplex, instead of Duplex unless the user specifies a socket | ||
jessekoconnor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type other than {net.Socket}. | ||
|
||
### Event: 'request' | ||
<!-- YAML | ||
added: v0.1.0 | ||
|
@@ -1040,7 +1062,7 @@ changes: | |
|
||
* `request` {http.IncomingMessage} Arguments for the HTTP request, as it is in | ||
the [`'request'`][] event | ||
* `socket` {net.Socket} Network socket between the server and client | ||
* `duplex` {stream.Duplex} Network socket between the server and client | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
* `head` {Buffer} The first packet of the upgraded stream (may be empty) | ||
|
||
Emitted each time a client requests an HTTP upgrade. Listening to this event | ||
|
@@ -1050,6 +1072,10 @@ After this event is emitted, the request's socket will not have a `'data'` | |
event listener, meaning it will need to be bound in order to handle data | ||
sent to the server on that socket. | ||
|
||
This event is guaranteed to be passed an instance of the {net.Socket} class, | ||
a subclass of Duplex, instead of Duplex unless the user specifies a socket | ||
jessekoconnor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type other than {net.Socket}. | ||
|
||
### server.close(\[callback\]) | ||
<!-- YAML | ||
added: v0.1.90 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to rename any arguments, it should be enough to change the type.