Browse Source

In HTTP parser, proxy return value of onHeadersComplete

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
35c14f637e
  1. 2
      lib/http.js
  2. 6
      src/node_http_parser.cc

2
lib/http.js

@ -85,6 +85,8 @@ var parsers = new FreeList('parsers', 1000, function () {
// so that we can capture the first part of the new protocol // so that we can capture the first part of the new protocol
parser.onIncoming(parser.incoming, info.shouldKeepAlive); parser.onIncoming(parser.incoming, info.shouldKeepAlive);
} }
return false; // Is response to HEAD request?
}; };
parser.onBody = function (b, start, len) { parser.onBody = function (b, start, len) {

6
src/node_http_parser.cc

@ -177,13 +177,13 @@ class Parser : public ObjectWrap {
Local<Value> argv[1] = { message_info }; Local<Value> argv[1] = { message_info };
Local<Value> ret = cb->Call(parser->handle_, 1, argv); Local<Value> head_response = cb->Call(parser->handle_, 1, argv);
if (ret.IsEmpty()) { if (head_response.IsEmpty()) {
parser->got_exception_ = true; parser->got_exception_ = true;
return -1; return -1;
} else { } else {
return 0; return head_response->IsTrue() ? 1 : 0;
} }
} }

Loading…
Cancel
Save