mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
http: abortIncoming only on socket close
Don't call abortIncombin twice for same socket, i.e. both during 'end' and 'close'. PR-URL: https://github.com/nodejs/node/pull/36821 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
committed by
James M Snell
parent
7be72850d3
commit
708728ddcc
@@ -581,11 +581,7 @@ function socketOnTimeout() {
|
||||
|
||||
function socketOnClose(socket, state) {
|
||||
debug('server socket close');
|
||||
// Mark this parser as reusable
|
||||
if (socket.parser) {
|
||||
freeParser(socket.parser, null, socket);
|
||||
}
|
||||
|
||||
freeParser(socket.parser, null, socket);
|
||||
abortIncoming(state.incoming);
|
||||
}
|
||||
|
||||
@@ -602,18 +598,15 @@ function socketOnEnd(server, socket, parser, state) {
|
||||
|
||||
if (ret instanceof Error) {
|
||||
debug('parse error');
|
||||
// socketOnError has additional logic and will call socket.destroy(err).
|
||||
FunctionPrototypeCall(socketOnError, socket, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!server.httpAllowHalfOpen) {
|
||||
abortIncoming(state.incoming);
|
||||
if (socket.writable) socket.end();
|
||||
} else if (!server.httpAllowHalfOpen) {
|
||||
socket.end();
|
||||
} else if (state.outgoing.length) {
|
||||
state.outgoing[state.outgoing.length - 1]._last = true;
|
||||
} else if (socket._httpMessage) {
|
||||
socket._httpMessage._last = true;
|
||||
} else if (socket.writable) {
|
||||
} else {
|
||||
socket.end();
|
||||
}
|
||||
}
|
||||
@@ -628,6 +621,7 @@ function socketOnData(server, socket, parser, state, d) {
|
||||
|
||||
function onRequestTimeout(socket) {
|
||||
socket[kRequestTimeout] = undefined;
|
||||
// socketOnError has additional logic and will call socket.destroy(err).
|
||||
ReflectApply(socketOnError, socket, [new ERR_HTTP_REQUEST_TIMEOUT()]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user