From: Ryan Date: Wed, 20 May 2009 14:05:31 +0000 (+0200) Subject: Camel case status_code and http_version. X-Git-Tag: v0.0.1~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb3a11d72a1e9735a5d3f1127993d740f56c686b;p=platform%2Fupstream%2Fnodejs.git Camel case status_code and http_version. --- diff --git a/src/http.cc b/src/http.cc index 936dcf3..a9ffddd 100644 --- a/src/http.cc +++ b/src/http.cc @@ -22,8 +22,8 @@ #define ON_MESSAGE_COMPLETE_SYMBOL String::NewSymbol("onMessageComplete") #define METHOD_SYMBOL String::NewSymbol("method") -#define STATUS_CODE_SYMBOL String::NewSymbol("status_code") -#define HTTP_VERSION_SYMBOL String::NewSymbol("http_version") +#define STATUS_CODE_SYMBOL String::NewSymbol("statusCode") +#define HTTP_VERSION_SYMBOL String::NewSymbol("httpVersion") #define SHOULD_KEEP_ALIVE_SYMBOL String::NewSymbol("should_keep_alive") using namespace v8; diff --git a/src/http.js b/src/http.js index ba9b474..05aee5d 100644 --- a/src/http.js +++ b/src/http.js @@ -154,14 +154,14 @@ node.http.ServerResponse = function (connection, responses) { var chunked_encoding = false; - this.sendHeader = function (status_code, headers) { + this.sendHeader = function (statusCode, headers) { var sent_connection_header = false; var sent_transfer_encoding_header = false; var sent_content_length_header = false; - var reason = node.http.STATUS_CODES[status_code] || "unknown"; + var reason = node.http.STATUS_CODES[statusCode] || "unknown"; var header = "HTTP/1.1 " - + status_code.toString() + + statusCode.toString() + " " + reason + CRLF @@ -264,7 +264,7 @@ node.http.Server = function (RequestHandler, options) { // filled in ... var req = { method : null // at onHeadersComplete , uri : "" // at onURI - , http_version : null // at onHeadersComplete + , httpVersion : null // at onHeadersComplete , headers : [] // at onHeaderField, onHeaderValue , onBody : null // by user , onBodyComplete : null // by user @@ -302,7 +302,7 @@ node.http.Server = function (RequestHandler, options) { }; this.onHeadersComplete = function () { - req.http_version = this.http_version; + req.httpVersion = this.httpVersion; req.method = this.method; req.uri = node.http.parseUri(req.uri); // TODO parse the URI lazily @@ -466,9 +466,9 @@ node.http.Client = function (port, host) { // On response connection.onMessage = function () { var req = requests.shift(); - var res = { status_code : null // set in onHeadersComplete - , http_version : null // set in onHeadersComplete - , headers : [] // set in onHeaderField/Value + var res = { statusCode : null // set in onHeadersComplete + , httpVersion : null // set in onHeadersComplete + , headers : [] // set in onHeaderField/Value , setBodyEncoding : function (enc) { connection.setEncoding(enc); } @@ -497,8 +497,8 @@ node.http.Client = function (port, host) { }; this.onHeadersComplete = function () { - res.status_code = this.status_code; - res.http_version = this.http_version; + res.statusCode = this.statusCode; + res.httpVersion = this.httpVersion; res.headers = headers; req.responseHandler(res); diff --git a/website/node.html b/website/node.html index b2b50c0..72a4643 100644 --- a/website/node.html +++ b/website/node.html @@ -263,7 +263,7 @@ class="sh_javascript">request_handler callback. ] -
req.http_version
+
req.httpVersion
The HTTP protocol version as a string. Read only. Examples: "1.1", "1.0" @@ -296,7 +296,7 @@ req.onBody = function (chunk) {

node.http.ServerResponse

-
res.sendHeader(status_code, headers)
+
res.sendHeader(statusCode, headers)
Sends a response header to the request. The status code is a 3-digit HTTP status code, like 404. The second argument, @@ -341,7 +341,7 @@ connection. (CURRENTLY: The client does not pipeline.) var google = new node.http.Client(80, "google.com"); var req = google.get("/"); req.finish(function (res) { - puts("STATUS: " + res.status_code); + puts("STATUS: " + res.statusCode); puts("HEADERS: " + JSON.stringify(res.headers)); res.setBodyEncoding("utf8"); res.onBody = function (chunk) { @@ -420,10 +420,10 @@ header is completely received but before any part of the response body has been read.
-
res.status_code
+
res.statusCode
The 3-digit HTTP response status code. (E.G. 404.)
-
res.http_version
+
res.httpVersion
The HTTP version of the connected-to server. Probably either "1.1" or "1.0".