http: fix free http-parser too early
when the status code is 100 (Continue). Fixes #2636.
This commit is contained in:
parent
b221fe9b29
commit
3fd13c6426
@ -1169,7 +1169,11 @@ ClientRequest.prototype.onSocket = function(socket) {
|
|||||||
socket.destroy();
|
socket.destroy();
|
||||||
}
|
}
|
||||||
freeParser();
|
freeParser();
|
||||||
} else if (parser.incoming && parser.incoming.complete) {
|
} else if (parser.incoming && parser.incoming.complete &&
|
||||||
|
// When the status code is 100 (Continue), the server will
|
||||||
|
// send a final response after this client sends a request
|
||||||
|
// body. So, we must not free the parser.
|
||||||
|
parser.incoming.statusCode !== 100) {
|
||||||
freeParser();
|
freeParser();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -44,7 +44,9 @@ server.on('checkContinue', function(req, res) {
|
|||||||
common.debug('Server got Expect: 100-continue...');
|
common.debug('Server got Expect: 100-continue...');
|
||||||
res.writeContinue();
|
res.writeContinue();
|
||||||
sent_continue = true;
|
sent_continue = true;
|
||||||
handler(req, res);
|
setTimeout(function() {
|
||||||
|
handler(req, res);
|
||||||
|
}, 100);
|
||||||
});
|
});
|
||||||
server.listen(common.PORT);
|
server.listen(common.PORT);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user