In HTTP parser, proxy return value of onHeadersComplete
authorRyan Dahl <ry@tinyclouds.org>
Wed, 26 May 2010 01:39:23 +0000 (18:39 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Wed, 26 May 2010 02:25:38 +0000 (19:25 -0700)
lib/http.js
src/node_http_parser.cc

index 2f46908..f46ef18 100644 (file)
@@ -85,6 +85,8 @@ var parsers = new FreeList('parsers', 1000, function () {
       // so that we can capture the first part of the new protocol
       parser.onIncoming(parser.incoming, info.shouldKeepAlive);
     }
+
+    return false; // Is response to HEAD request?
   };
 
   parser.onBody = function (b, start, len) {
index 3473686..29423c0 100644 (file)
@@ -177,13 +177,13 @@ class Parser : public ObjectWrap {
 
     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;
       return -1;
     } else {
-      return 0;
+      return head_response->IsTrue() ? 1 : 0;
     }
   }