Browse Source

HTTP Agent should not die on evil server

Closes GH-680.
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
9b0c7618c5
  1. 10
      lib/http.js

10
lib/http.js

@ -1244,9 +1244,15 @@ Agent.prototype._establishNewConnection = function() {
parser.onIncoming = function(res, shouldKeepAlive) {
debug('AGENT incoming response!');
var req = socket._httpMessage;
assert(req);
// If we're receiving a message but we don't have a corresponding
// request - then somehow the server is seriously messed up and sending
// multiple responses at us. In this case we'll just bail.
if (!socket._httpMessage) {
socket.destroy();
return;
}
var req = socket._httpMessage;
req.res = res;
// Responses to HEAD requests are AWFUL. Ask Ryan.

Loading…
Cancel
Save