Skip to content

Commit 5e1369f

Browse files
committed
update after addaleax' review
1 parent e9eb792 commit 5e1369f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

doc/api/http.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,10 @@ object, so any HTTP response sent, including response headers and payload,
765765
*must* be written directly to the `socket` object. Care must be taken to
766766
ensure the response is a properly formatted HTTP response message.
767767

768-
> `err` is an instance of `Error` with two extra columns:
769-
>
770-
> + `bytesParsed`: the bytes count of request packet that Node.js may parse correctly;
771-
> + `rawPacket`: the raw packet of current request.
768+
`err` is an instance of `Error` with two extra columns:
769+
770+
+ `bytesParsed`: the bytes count of request packet that Node.js may have parsed correctly;
771+
+ `rawPacket`: the raw packet of current request.
772772

773773
### Event: 'close'
774774
<!-- YAML

lib/_http_server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,11 @@ 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+
478481
if (ret instanceof Error) {
479-
ret.rawPacket = d || parser.getCurrentBuffer();
482+
ret.rawPacket = d;
480483
debug('parse error', ret);
481484
socketOnError.call(socket, ret);
482485
} else if (parser.incoming && parser.incoming.upgrade) {
@@ -485,9 +488,6 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) {
485488
var req = parser.incoming;
486489
debug('SERVER upgrade or connect', req.method);
487490

488-
if (!d)
489-
d = parser.getCurrentBuffer();
490-
491491
socket.removeListener('data', state.onData);
492492
socket.removeListener('end', state.onEnd);
493493
socket.removeListener('close', state.onClose);

0 commit comments

Comments
 (0)