mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
onBodyComplete was not getting called in HTTP server
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user