onBodyComplete was not getting called in HTTP server

This commit is contained in:
Ryan committed 2009-06-12 15:26:06 +02:00
1 parent 1ec9f821e1
commit 3a0de007aa
3 files changed
+12 -9

No files matched your search

+3 -3
View File
@@ -262,12 +262,12 @@ HTTPConnection::on_message_complete (http_parser *parser)
Local<Value> message_handler_v =
connection->handle_->GetHiddenValue(MESSAGE_HANDLER_SYMBOL);
Local<Object> message_handler = message_handler_v->ToObject();
connection->handle_->DeleteHiddenValue(MESSAGE_HANDLER_SYMBOL);
Local<Object> message_handler = message_handler_v->ToObject();
Local<Value> on_msg_complete_v = message_handler->Get(ON_MESSAGE_COMPLETE_SYMBOL);
if (on_msg_complete_v->IsFunction() == false)
return 0;
if (on_msg_complete_v->IsFunction() == false) return 0;
Handle<Function> on_msg_complete = Handle<Function>::Cast(on_msg_complete_v);
TryCatch try_catch;
+3 -2
View File
@@ -296,9 +296,9 @@ node.http.Server = function (RequestHandler, options) {
return true;
};
this.onBodyComplete = function () {
this.onMessageComplete = function () {
if (req.onBodyComplete)
return req.onBodyComplete(chunk);
return req.onBodyComplete();
else
return true;
};
@@ -464,6 +464,7 @@ node.http.Client = function (port, host) {
res.headers = headers;
req.responseHandler(res);
return true;
};
this.onBody = function (chunk) {
+6 -4
View File
@@ -19,10 +19,12 @@ function onLoad () {
this.close();
}
res.sendHeader(200, [["Content-Type", "text/plain"]]);
res.sendBody("The path was " + req.uri.path);
res.finish();
responses_sent += 1;
req.onBodyComplete = function () {
res.sendHeader(200, [["Content-Type", "text/plain"]]);
res.sendBody("The path was " + req.uri.path);
res.finish();
responses_sent += 1;
};
}).listen(PORT);
var client = new node.http.Client(PORT);