Browse Source

Camel-case all http events

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
cda659a8c8
  1. 10
      lib/http.js
  2. 10
      src/http.cc

10
lib/http.js

@ -332,7 +332,7 @@ function createIncomingMessageStream (connection, incoming_listener) {
var incoming; var incoming;
var field = null, value = null; var field = null, value = null;
connection.addListener("message_begin", function () { connection.addListener("messageBegin", function () {
incoming = new IncomingMessage(connection); incoming = new IncomingMessage(connection);
}); });
@ -341,7 +341,7 @@ function createIncomingMessageStream (connection, incoming_listener) {
incoming.uri += data; incoming.uri += data;
}); });
connection.addListener("header_field", function (data) { connection.addListener("headerField", function (data) {
if (value) { if (value) {
incoming._addHeaderLine(field, value); incoming._addHeaderLine(field, value);
field = null; field = null;
@ -354,7 +354,7 @@ function createIncomingMessageStream (connection, incoming_listener) {
} }
}); });
connection.addListener("header_value", function (data) { connection.addListener("headerValue", function (data) {
if (value) { if (value) {
value += data; value += data;
} else { } else {
@ -362,7 +362,7 @@ function createIncomingMessageStream (connection, incoming_listener) {
} }
}); });
connection.addListener("headers_complete", function (info) { connection.addListener("headerComplete", function (info) {
if (field && value) { if (field && value) {
incoming._addHeaderLine(field, value); incoming._addHeaderLine(field, value);
} }
@ -385,7 +385,7 @@ function createIncomingMessageStream (connection, incoming_listener) {
incoming.emit("body", chunk); incoming.emit("body", chunk);
}); });
connection.addListener("message_complete", function () { connection.addListener("messageComplete", function () {
incoming.emit("complete"); incoming.emit("complete");
}); });

10
src/http.cc

@ -69,7 +69,7 @@ HTTPConnection::on_message_begin (http_parser *parser)
{ {
HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data); HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data);
assert(connection->attached_); assert(connection->attached_);
connection->Emit("message_begin", 0, NULL); connection->Emit("messageBegin", 0, NULL);
return 0; return 0;
} }
@ -78,7 +78,7 @@ HTTPConnection::on_message_complete (http_parser *parser)
{ {
HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data); HTTPConnection *connection = static_cast<HTTPConnection*> (parser->data);
assert(connection->attached_); assert(connection->attached_);
connection->Emit("message_complete", 0, NULL); connection->Emit("messageComplete", 0, NULL);
return 0; return 0;
} }
@ -100,7 +100,7 @@ HTTPConnection::on_header_field (http_parser *parser, const char *buf, size_t le
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->attached_); assert(connection->attached_);
Local<Value> argv[1] = { String::New(buf, len) }; Local<Value> argv[1] = { String::New(buf, len) };
connection->Emit("header_field", 1, argv); connection->Emit("headerField", 1, argv);
return 0; return 0;
} }
@ -111,7 +111,7 @@ HTTPConnection::on_header_value (http_parser *parser, const char *buf, size_t le
HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data); HTTPConnection *connection = static_cast<HTTPConnection*>(parser->data);
assert(connection->attached_); assert(connection->attached_);
Local<Value> argv[1] = { String::New(buf, len) }; Local<Value> argv[1] = { String::New(buf, len) };
connection->Emit("header_value", 1, argv); connection->Emit("headerValue", 1, argv);
return 0; return 0;
} }
@ -173,7 +173,7 @@ HTTPConnection::on_headers_complete (http_parser *parser)
Local<Value> argv[1] = { message_info }; Local<Value> argv[1] = { message_info };
connection->Emit("headers_complete", 1, argv); connection->Emit("headerComplete", 1, argv);
return 0; return 0;
} }

Loading…
Cancel
Save