Skip to content

Commit 008e5a8

Browse files
committed
update
1 parent 9758fb1 commit 008e5a8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

doc/api/http.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ changes:
734734
description: The default action of calling `.destroy()` on the `socket`
735735
will no longer take place if there are listeners attached
736736
for `clientError`.
737-
- version: VERSION
737+
- version: REPLACEME
738738
pr-url: https://github.com/nodejs/node/pull/17672
739739
description: The rawPacket is the current buffer that just parsed. Adding
740740
this buffer to the error object of clientError event is to make

lib/_http_server.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,8 @@ function socketOnError(e) {
475475
function onParserExecuteCommon(server, socket, parser, state, ret, d) {
476476
resetSocketTimeout(server, socket, state);
477477

478-
if (!d) {
479-
d = parser.getCurrentBuffer();
480-
}
481-
482478
if (ret instanceof Error) {
483-
ret.rawPacket = d;
479+
ret.rawPacket = d || parser.getCurrentBuffer();
484480
debug('parse error', ret);
485481
socketOnError.call(socket, ret);
486482
} else if (parser.incoming && parser.incoming.upgrade) {
@@ -489,6 +485,9 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) {
489485
var req = parser.incoming;
490486
debug('SERVER upgrade or connect', req.method);
491487

488+
if (!d)
489+
d = parser.getCurrentBuffer();
490+
492491
socket.removeListener('data', state.onData);
493492
socket.removeListener('end', state.onEnd);
494493
socket.removeListener('close', state.onClose);

0 commit comments

Comments
 (0)