Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
55e6663
doc: update http.md mention of socket
jessekoconnor Oct 28, 2019
9eb3fac
docs: correct line spacing
jessekoconnor Oct 28, 2019
8572afb
doc: update stream obj to duplex obj
jessekoconnor Oct 30, 2019
863f6f4
doc: reword socket documentation wording
jessekoconnor Oct 30, 2019
d49e4dd
doc: Capitalize Duplex when referring to class
jessekoconnor Oct 30, 2019
38171e9
doc: update request.keepAlive(duplex)
jessekoconnor Oct 30, 2019
094d513
doc: update the events on Agent first
jessekoconnor Oct 31, 2019
e54b9e9
fix: update rest of events
jessekoconnor Oct 31, 2019
2eec64c
fix: forgot one explanation
jessekoconnor Oct 31, 2019
5b827a3
doc: suggest doc for methods
jessekoconnor Oct 31, 2019
fce5f9c
doc: address rest of relevant methods
jessekoconnor Oct 31, 2019
7cf2e18
doc: suggestion from tniessen
jessekoconnor Nov 1, 2019
da4eec8
Update doc/api/http.md
jessekoconnor Nov 1, 2019
d08c71e
Update doc/api/http.md
jessekoconnor Nov 1, 2019
352fce8
Update doc/api/http.md
jessekoconnor Nov 1, 2019
916b271
Update doc/api/http.md
jessekoconnor Nov 1, 2019
8f39b79
Update doc/api/http.md
jessekoconnor Nov 1, 2019
f1419f3
Update doc/api/http.md
jessekoconnor Nov 1, 2019
92bbaec
Update doc/api/http.md
jessekoconnor Nov 1, 2019
b545157
doc: wording suggestion from tniessen
jessekoconnor Nov 1, 2019
220cecb
doc: more tidying up
jessekoconnor Nov 1, 2019
92fbdef
doc: even more tidying up
jessekoconnor Nov 1, 2019
6809c26
fix: update further
jessekoconnor Nov 1, 2019
14cf7aa
Update doc/api/http.md
jessekoconnor Nov 3, 2019
1fc5adf
doc: Updates based on feedback from tniesson
jessekoconnor Nov 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: update the events on Agent first
  • Loading branch information
jessekoconnor committed Oct 31, 2019
commit 094d513da8e997f84012f94e8253ace9271b2c19
30 changes: 17 additions & 13 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ socket/stream from this function, or by passing the socket/stream to `callback`.

`callback` has a signature of `(err, stream)`.

### agent.keepSocketAlive(duplex)
### agent.keepSocketAlive(socket)
<!-- YAML
added: v8.1.0
-->

* `duplex` {stream.Duplex}
* `socket` {net.Socket}

Called when socket is detached from a request and could be persisted by the
Called when `socket` is detached from a request and could be persisted by the
`Agent`. Default behavior is to:

```js
Expand All @@ -185,10 +185,6 @@ socket.unref();
return true;
```

This event is guaranteed to be passed an instance of the {net.Socket} class,
a subclass of Duplex, unless the user specifies a socket type other than
{net.Socket}.

This method can be overridden by a particular `Agent` subclass. If this
method returns a falsy value, the socket will be destroyed instead of persisting
it for use with the next request.
Expand Down Expand Up @@ -345,13 +341,17 @@ added: v0.7.0
-->

* `response` {http.IncomingMessage}
* `socket` {net.Socket}
* `duplex` {stream.Duplex}
Copy link
Copy Markdown
Member

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.

* `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
Comment thread
jessekoconnor marked this conversation as resolved.
Outdated
type other than {net.Socket}.

A client and server pair demonstrating how to listen for the `'connect'` event:

```js
Expand Down Expand Up @@ -477,9 +477,9 @@ added: v0.5.3

* `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, unless
the user specifies a socket type other than {net.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
Comment thread
jessekoconnor marked this conversation as resolved.
Outdated
type other than {net.Socket}.

### Event: 'timeout'
<!-- YAML
Expand All @@ -497,7 +497,7 @@ 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
Expand Down Expand Up @@ -941,13 +941,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
Comment thread
jessekoconnor marked this conversation as resolved.
Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
Expand Down