Commit f153d6da authored by isaacs's avatar isaacs
Browse files

http client: pull last chunk on socket close

When the socket closes, the client's http incoming message object was
emitting an 'aborted' event if it had not yet been ended.

However, it's possible, when a response is being repeatedly paused and
resumed (eg, if piped to a slow FS write stream), that there will be a
final chunk remaining in the js-land buffer when the socket is torn
down.

When that happens, the socketCloseListener function detects that we have
not yet reached the end of the response message data, and treats this as
an abrupt abort, immediately (and forcibly) ending the incoming message
data stream, and discarding that final chunk of data.

The result is that, for example, npm will have problems because tarballs
are missing a few bytes off the end, every time.

Closes GH-6402
parent 0079e575
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment