Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/http_simple.js2
-rw-r--r--benchmark/static_http_server.js2
-rw-r--r--doc/api.txt12
-rw-r--r--doc/index.html2
-rw-r--r--lib/http.js7
-rw-r--r--test/pummel/test-keep-alive.js2
-rw-r--r--test/pummel/test-multipart.js4
-rw-r--r--test/simple/test-http-1.0.js2
-rw-r--r--test/simple/test-http-cat.js2
-rw-r--r--test/simple/test-http-chunked.js2
-rw-r--r--test/simple/test-http-client-race.js2
-rw-r--r--test/simple/test-http-client-upload.js2
-rw-r--r--test/simple/test-http-malformed-request.js2
-rw-r--r--test/simple/test-http-proxy.js4
-rw-r--r--test/simple/test-http-server.js2
-rw-r--r--test/simple/test-http-tls.js2
-rw-r--r--test/simple/test-http-wget.js2
-rw-r--r--test/simple/test-http.js2
-rw-r--r--test/simple/test-remote-module-loading.js2
19 files changed, 29 insertions, 28 deletions
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js
index 1d758b03281..8bfc0972446 100644
--- a/benchmark/http_simple.js
+++ b/benchmark/http_simple.js
@@ -47,7 +47,7 @@ http.createServer(function (req, res) {
var content_length = body.length.toString();
- res.writeHeader( status
+ res.writeHead( status
, { "Content-Type": "text/plain"
, "Content-Length": content_length
}
diff --git a/benchmark/static_http_server.js b/benchmark/static_http_server.js
index 5bc48120f6e..5b4f220ba8c 100644
--- a/benchmark/static_http_server.js
+++ b/benchmark/static_http_server.js
@@ -16,7 +16,7 @@ for (var i = 0; i < bytes; i++) {
}
var server = http.createServer(function (req, res) {
- res.writeHeader(200, {
+ res.writeHead(200, {
"Content-Type": "text/plain",
"Content-Length": body.length
});
diff --git a/doc/api.txt b/doc/api.txt
index 23a697a8fd7..13e70f4c498 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -19,7 +19,7 @@ World":
var sys = require("sys"),
http = require("http");
http.createServer(function (request, response) {
- response.writeHeader(200, {"Content-Type": "text/plain"});
+ response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World\n");
response.close();
}).listen(8000);
@@ -951,7 +951,7 @@ The +http.Connection+ object.
This object is created internally by a HTTP server--not by the user. It is
passed as the second parameter to the +"request"+ event.
-+response.writeHeader(statusCode[, reasonPhrase] , headers)+ ::
++response.writeHead(statusCode[, reasonPhrase] , headers)+ ::
Sends a response header to the request. The status code is a 3-digit HTTP
status code, like +404+. The last argument, +headers+, are the response headers.
@@ -962,7 +962,7 @@ Example:
+
----------------------------------------
var body = "hello world";
-response.writeHeader(200, {
+response.writeHead(200, {
"Content-Length": body.length,
"Content-Type": "text/plain"
});
@@ -973,7 +973,7 @@ be called before +response.close()+ is called.
+response.write(chunk, encoding="ascii")+ ::
-This method must be called after +writeHeader+ was
+This method must be called after +writeHead+ was
called. It sends a chunk of the response body. This method may
be called multiple times to provide successive parts of the body.
+
@@ -1297,7 +1297,7 @@ http.createServer(function (req, res) {
fields = {},
name, filename;
mp.addListener("error", function (er) {
- res.writeHeader(400, {"content-type":"text/plain"});
+ res.writeHead(400, {"content-type":"text/plain"});
res.write("You sent a bad message!\n"+er.message);
res.close();
});
@@ -1317,7 +1317,7 @@ http.createServer(function (req, res) {
});
mp.addListener("complete", function () {
var response = "You posted: \n" + sys.inspect(fields);
- res.writeHeader(200, {
+ res.writeHead(200, {
"content-type" : "text/plain",
"content-length" : response.length
});
diff --git a/doc/index.html b/doc/index.html
index b471e8c3663..d5f3661f3b2 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -48,7 +48,7 @@ var sys = require('sys'),
http = require('http');
http.createServer(function (req, res) {
setTimeout(function () {
- res.writeHeader(200, {'Content-Type': 'text/plain'});
+ res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World');
res.close();
}, 2000);
diff --git a/lib/http.js b/lib/http.js
index 6278b7175e6..5e514e4be7f 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -257,7 +257,7 @@ sys.inherits(ServerResponse, OutgoingMessage);
exports.ServerResponse = ServerResponse;
-ServerResponse.prototype.writeHeader = function (statusCode) {
+ServerResponse.prototype.writeHead = function (statusCode) {
var reasonPhrase, headers, headerIndex;
if (typeof arguments[1] == 'string') {
@@ -279,8 +279,9 @@ ServerResponse.prototype.writeHeader = function (statusCode) {
this.sendHeaderLines(status_line, headers);
};
-// TODO eventually remove sendHeader()
-ServerResponse.prototype.sendHeader = ServerResponse.prototype.writeHeader;
+// TODO eventually remove sendHeader(), writeHeader()
+ServerResponse.prototype.sendHeader = ServerResponse.prototype.writeHead;
+ServerResponse.prototype.writeHeader = ServerResponse.prototype.writeHead;
function ClientRequest (method, url, headers) {
OutgoingMessage.call(this);
diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js
index 4b8dc93ea72..d9d444d21cc 100644
--- a/test/pummel/test-keep-alive.js
+++ b/test/pummel/test-keep-alive.js
@@ -6,7 +6,7 @@ PORT = 8891;
body = "hello world\n";
server = http.createServer(function (req, res) {
- res.writeHeader(200, {
+ res.writeHead(200, {
"Content-Length": body.length,
"Content-Type": "text/plain",
});
diff --git a/test/pummel/test-multipart.js b/test/pummel/test-multipart.js
index b542e99acc7..4ba19e2ebcd 100644
--- a/test/pummel/test-multipart.js
+++ b/test/pummel/test-multipart.js
@@ -77,12 +77,12 @@ var server = http.createServer(function (req, res) {
}
mp.addListener("error", function (er) {
sys.puts("!! error occurred");
- res.writeHeader(400, {});
+ res.writeHead(400, {});
res.write("bad");
res.close();
});
mp.addListener("complete", function () {
- res.writeHeader(200, {});
+ res.writeHead(200, {});
res.write("ok");
res.close();
});
diff --git a/test/simple/test-http-1.0.js b/test/simple/test-http-1.0.js
index 801972ca2f7..455b9e22544 100644
--- a/test/simple/test-http-1.0.js
+++ b/test/simple/test-http-1.0.js
@@ -9,7 +9,7 @@ var server_response = "";
var client_got_eof = false;
var server = http.createServer(function (req, res) {
- res.writeHeader(200, {"Content-Type": "text/plain"});
+ res.writeHead(200, {"Content-Type": "text/plain"});
res.write(body);
res.close();
})
diff --git a/test/simple/test-http-cat.js b/test/simple/test-http-cat.js
index 9e26b4b3a4e..c6c2de845ba 100644
--- a/test/simple/test-http-cat.js
+++ b/test/simple/test-http-cat.js
@@ -5,7 +5,7 @@ PORT = 8888;
var body = "exports.A = function() { return 'A';}";
var server = http.createServer(function (req, res) {
puts("got request");
- res.writeHeader(200, [
+ res.writeHead(200, [
["Content-Length", body.length],
["Content-Type", "text/plain"]
]);
diff --git a/test/simple/test-http-chunked.js b/test/simple/test-http-chunked.js
index f1895737b1a..2ff677c2f0f 100644
--- a/test/simple/test-http-chunked.js
+++ b/test/simple/test-http-chunked.js
@@ -5,7 +5,7 @@ var PORT = 8888;
var UTF8_STRING = "Il était tué";
var server = http.createServer(function(req, res) {
- res.writeHeader(200, {"Content-Type": "text/plain; charset=utf8"});
+ res.writeHead(200, {"Content-Type": "text/plain; charset=utf8"});
res.write(UTF8_STRING, 'utf8');
res.close();
});
diff --git a/test/simple/test-http-client-race.js b/test/simple/test-http-client-race.js
index 3541830f069..2ae92bcaeb6 100644
--- a/test/simple/test-http-client-race.js
+++ b/test/simple/test-http-client-race.js
@@ -8,7 +8,7 @@ var body2_s = "22222";
var server = http.createServer(function (req, res) {
var body = url.parse(req.url).pathname === "/1" ? body1_s : body2_s;
- res.writeHeader(200, { "Content-Type": "text/plain"
+ res.writeHead(200, { "Content-Type": "text/plain"
, "Content-Length": body.length
});
res.write(body);
diff --git a/test/simple/test-http-client-upload.js b/test/simple/test-http-client-upload.js
index 880b229f29f..91fc6606512 100644
--- a/test/simple/test-http-client-upload.js
+++ b/test/simple/test-http-client-upload.js
@@ -18,7 +18,7 @@ var server = http.createServer(function(req, res) {
req.addListener('end', function () {
server_req_complete = true;
puts("request complete from server");
- res.writeHeader(200, {'Content-Type': 'text/plain'});
+ res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('hello\n');
res.close();
});
diff --git a/test/simple/test-http-malformed-request.js b/test/simple/test-http-malformed-request.js
index 5d2efc17f25..27b6e80fcef 100644
--- a/test/simple/test-http-malformed-request.js
+++ b/test/simple/test-http-malformed-request.js
@@ -13,7 +13,7 @@ nrequests_expected = 1;
var s = http.createServer(function (req, res) {
puts("req: " + JSON.stringify(url.parse(req.url)));
- res.writeHeader(200, {"Content-Type": "text/plain"});
+ res.writeHead(200, {"Content-Type": "text/plain"});
res.write("Hello World");
res.close();
diff --git a/test/simple/test-http-proxy.js b/test/simple/test-http-proxy.js
index 5f7bac52699..f3bd0a8e93d 100644
--- a/test/simple/test-http-proxy.js
+++ b/test/simple/test-http-proxy.js
@@ -7,7 +7,7 @@ var BACKEND_PORT = 8870;
var backend = http.createServer(function (req, res) {
// debug("backend");
- res.writeHeader(200, {"content-type": "text/plain"});
+ res.writeHead(200, {"content-type": "text/plain"});
res.write("hello world\n");
res.close();
});
@@ -19,7 +19,7 @@ var proxy = http.createServer(function (req, res) {
debug("proxy req headers: " + JSON.stringify(req.headers));
var proxy_req = proxy_client.request(url.parse(req.url).pathname);
proxy_req.addListener('response', function(proxy_res) {
- res.writeHeader(proxy_res.statusCode, proxy_res.headers);
+ res.writeHead(proxy_res.statusCode, proxy_res.headers);
proxy_res.addListener("data", function(chunk) {
res.write(chunk);
});
diff --git a/test/simple/test-http-server.js b/test/simple/test-http-server.js
index b9f48000ca4..307256b7485 100644
--- a/test/simple/test-http-server.js
+++ b/test/simple/test-http-server.js
@@ -38,7 +38,7 @@ http.createServer(function (req, res) {
}
setTimeout(function () {
- res.writeHeader(200, {"Content-Type": "text/plain"});
+ res.writeHead(200, {"Content-Type": "text/plain"});
res.write(url.parse(req.url).pathname);
res.close();
}, 1);
diff --git a/test/simple/test-http-tls.js b/test/simple/test-http-tls.js
index 99319828946..c250adf8e63 100644
--- a/test/simple/test-http-tls.js
+++ b/test/simple/test-http-tls.js
@@ -52,7 +52,7 @@ var http_server=http.createServer(function (req, res) {
}
req.addListener('end', function () {
- res.writeHeader(200, {"Content-Type": "text/plain"});
+ res.writeHead(200, {"Content-Type": "text/plain"});
res.write("The path was " + url.parse(req.url).pathname);
res.close();
responses_sent += 1;
diff --git a/test/simple/test-http-wget.js b/test/simple/test-http-wget.js
index 5563a3dd707..1184c463605 100644
--- a/test/simple/test-http-wget.js
+++ b/test/simple/test-http-wget.js
@@ -24,7 +24,7 @@ var client_got_eof = false;
var connection_was_closed = false;
var server = http.createServer(function (req, res) {
- res.writeHeader(200, {"Content-Type": "text/plain"});
+ res.writeHead(200, {"Content-Type": "text/plain"});
res.write("hello ");
res.write("world\n");
res.close();
diff --git a/test/simple/test-http.js b/test/simple/test-http.js
index b5ecdbef20f..815ebf925e6 100644
--- a/test/simple/test-http.js
+++ b/test/simple/test-http.js
@@ -28,7 +28,7 @@ http.createServer(function (req, res) {
}
req.addListener('end', function () {
- res.writeHeader(200, {"Content-Type": "text/plain"});
+ res.writeHead(200, {"Content-Type": "text/plain"});
res.write("The path was " + url.parse(req.url).pathname);
res.close();
responses_sent += 1;
diff --git a/test/simple/test-remote-module-loading.js b/test/simple/test-remote-module-loading.js
index 350e78ea9ec..3b99ea629bc 100644
--- a/test/simple/test-remote-module-loading.js
+++ b/test/simple/test-remote-module-loading.js
@@ -11,7 +11,7 @@ var server = http.createServer(function(req, res) {
'return '+JSON.stringify(url.parse(req.url).pathname)+';'+
'};';
- res.writeHeader(200, {'Content-Type': 'text/javascript'});
+ res.writeHead(200, {'Content-Type': 'text/javascript'});
res.write(body);
res.close();
});