Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
XadillaX committed Dec 18, 2017
1 parent 9758fb1 commit 008e5a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ changes:
description: The default action of calling `.destroy()` on the `socket`
will no longer take place if there are listeners attached
for `clientError`.
- version: VERSION
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/17672
description: The rawPacket is the current buffer that just parsed. Adding
this buffer to the error object of clientError event is to make
Expand Down
9 changes: 4 additions & 5 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,8 @@ function socketOnError(e) {
function onParserExecuteCommon(server, socket, parser, state, ret, d) {
resetSocketTimeout(server, socket, state);

if (!d) {
d = parser.getCurrentBuffer();
}

if (ret instanceof Error) {
ret.rawPacket = d;
ret.rawPacket = d || parser.getCurrentBuffer();
debug('parse error', ret);
socketOnError.call(socket, ret);
} else if (parser.incoming && parser.incoming.upgrade) {
Expand All @@ -489,6 +485,9 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) {
var req = parser.incoming;
debug('SERVER upgrade or connect', req.method);

if (!d)
d = parser.getCurrentBuffer();

socket.removeListener('data', state.onData);
socket.removeListener('end', state.onEnd);
socket.removeListener('close', state.onClose);
Expand Down

0 comments on commit 008e5a8

Please sign in to comment.