0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 15:06:33 +01:00

Camel case status_code and http_version.

This commit is contained in:
Ryan 2009-05-20 16:05:31 +02:00
parent 691467670d
commit cb3a11d72a
3 changed files with 17 additions and 17 deletions

View File

@ -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;

View File

@ -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);

View File

@ -263,7 +263,7 @@ class="sh_javascript">request_handler</code> callback.
]
</pre>
<dt><code class="sh_javascript">req.http_version</code></dt>
<dt><code class="sh_javascript">req.httpVersion</code></dt>
<dd>The HTTP protocol version as a string. Read only. Examples: <code class="sh_javascript">"1.1"</code>,
<code class="sh_javascript">"1.0"</code>
@ -296,7 +296,7 @@ req.onBody = function (chunk) {
<h4 id="http_server_response"><code class="sh_javascript">node.http.ServerResponse</code></h4>
<dl>
<dt><code class="sh_javascript">res.sendHeader(status_code, headers)</code></dt>
<dt><code class="sh_javascript">res.sendHeader(statusCode, headers)</code></dt>
<dd>
Sends a response header to the request. The status code is a 3-digit
HTTP status code, like <code class="sh_javascript">404</code>. 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.
<dl>
<dt><code class="sh_javascript">res.status_code</code></dt>
<dt><code class="sh_javascript">res.statusCode</code></dt>
<dd>The 3-digit HTTP response status code. (E.G. <code class="sh_javascript">404</code>.)</dd>
<dt><code class="sh_javascript">res.http_version</code></dt>
<dt><code class="sh_javascript">res.httpVersion</code></dt>
<dd>The HTTP version of the connected-to server. Probably either
<code class="sh_javascript">"1.1"</code> or
<code class="sh_javascript">"1.0"</code>.