-
Notifications
You must be signed in to change notification settings - Fork 7.3k
http.request(method: HEAD) + server keep-alive = uncatchable "Parse error" #2206
Comments
Because the response of With |
I know that is illegal response, but I want to catch this error in |
Because the response is completed successfully, the If the second request exists, it emits res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
// append below
res.on('end', function() {
http.globalAgent.maxSockets = 1;
var req2 = http.request(options, function(res2) {
});
req2.on('error', function(e) {
console.log('HANDLED by REQ2: ' + e.message);
});
req.end();
}); result:
Because illegal data ( You can catch the error on the socket. req.on('error', function(e) {
console.log('HANDLED by SOCKET: ' + e.message);
});
// append below
req.on('socket', function(socket) {
socket.on('error', function(e) {
console.log('SOCKET HANDLED: ' + e.message);
});
}); result:
|
resolved? |
Yep, resolved as of 827b2a9. |
In the HEAD-request if the server responded
Connection: keep-alive
thenhttp.request()
throws aParse error
, but a handler forerror
is not called.server.js
client.js
result:
System info
The text was updated successfully, but these errors were encountered: