mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 15:06:33 +01:00
Fixes to get HTTP working with new TCP API.
This commit is contained in:
parent
589d8af5d4
commit
81691c7dc5
13
src/http.cc
13
src/http.cc
@ -57,9 +57,6 @@ Handle<Value>
|
||||
HTTPConnection::v8NewClient (const Arguments& args)
|
||||
{
|
||||
HandleScope scope;
|
||||
if (args[0]->IsFunction() == false)
|
||||
return ThrowException(String::New("Must pass a class as the first argument."));
|
||||
Local<Function> protocol_class = Local<Function>::Cast(args[0]);
|
||||
new HTTPConnection(args.This(), HTTP_RESPONSE);
|
||||
return args.This();
|
||||
}
|
||||
@ -68,9 +65,6 @@ Handle<Value>
|
||||
HTTPConnection::v8NewServer (const Arguments& args)
|
||||
{
|
||||
HandleScope scope;
|
||||
if (args[0]->IsFunction() == false)
|
||||
return ThrowException(String::New("Must pass a class as the first argument."));
|
||||
Local<Function> protocol_class = Local<Function>::Cast(args[0]);
|
||||
new HTTPConnection(args.This(), HTTP_REQUEST);
|
||||
return args.This();
|
||||
}
|
||||
@ -349,6 +343,13 @@ HTTPServer::OnConnection (struct sockaddr *addr, socklen_t len)
|
||||
|
||||
connection->SetAcceptor(handle_);
|
||||
|
||||
Handle<Value> argv[1] = { connection_handle };
|
||||
|
||||
Local<Value> ret = connection_handler->Call(handle_, 1, argv);
|
||||
|
||||
if (ret.IsEmpty())
|
||||
fatal_exception(try_catch);
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,7 @@ node.http.Server = function (RequestHandler, options) {
|
||||
if (!(this instanceof node.http.Server))
|
||||
throw Error("Constructor called as a function");
|
||||
|
||||
function Protocol (connection) {
|
||||
|
||||
function ConnectionHandler (connection) {
|
||||
// An array of messages for each connection. In pipelined connections
|
||||
// we need to keep track of the order they were sent.
|
||||
var messages = [];
|
||||
@ -211,7 +210,6 @@ node.http.Server = function (RequestHandler, options) {
|
||||
}
|
||||
|
||||
connection.onMessage = function ( ) {
|
||||
puts("got onMessage");
|
||||
var msg = new Message();
|
||||
|
||||
msg.path = "";
|
||||
@ -263,5 +261,5 @@ node.http.Server = function (RequestHandler, options) {
|
||||
};
|
||||
}
|
||||
|
||||
this.__proto__.__proto__ = new node.http.LowLevelServer(Protocol, options);
|
||||
this.__proto__.__proto__ = new node.http.LowLevelServer(ConnectionHandler, options);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user