зеркало из https://github.com/mozilla/gecko-dev.git
Add a bunch of forgotten |false| parameters to setHeader calls in httpd.js server handlers; no functionality change because absence defaulted to false. No bug, test-only set of trivial changes so self-reviewing...
This commit is contained in:
Родитель
2d52e5f066
Коммит
5d7f3c8860
|
@ -50,8 +50,8 @@ const IMAGE_DATA =
|
||||||
|
|
||||||
function handleRequest(request, response)
|
function handleRequest(request, response)
|
||||||
{
|
{
|
||||||
response.setHeader("Content-Type", "text/plain");
|
response.setHeader("Content-Type", "text/plain", false);
|
||||||
response.setHeader("Cache-Control", "no-cache");
|
response.setHeader("Cache-Control", "no-cache", false);
|
||||||
|
|
||||||
var accept = request.hasHeader("Accept")
|
var accept = request.hasHeader("Accept")
|
||||||
? request.getHeader("Accept")
|
? request.getHeader("Accept")
|
||||||
|
|
|
@ -190,7 +190,7 @@ var objHandler =
|
||||||
function functionHandler(metadata, response)
|
function functionHandler(metadata, response)
|
||||||
{
|
{
|
||||||
response.setStatusLine("1.1", 404, "Page Not Found");
|
response.setStatusLine("1.1", 404, "Page Not Found");
|
||||||
response.setHeader("foopy", "quux-baz");
|
response.setHeader("foopy", "quux-baz", false);
|
||||||
|
|
||||||
do_check_eq(metadata.port, 4444);
|
do_check_eq(metadata.port, 4444);
|
||||||
do_check_eq(metadata.host, "localhost");
|
do_check_eq(metadata.host, "localhost");
|
||||||
|
|
|
@ -200,12 +200,12 @@ function testHasHeader()
|
||||||
{
|
{
|
||||||
var headers = new nsHttpHeaders();
|
var headers = new nsHttpHeaders();
|
||||||
|
|
||||||
headers.setHeader("foo", "bar");
|
headers.setHeader("foo", "bar", false);
|
||||||
do_check_true(headers.hasHeader("foo"));
|
do_check_true(headers.hasHeader("foo"));
|
||||||
do_check_true(headers.hasHeader("fOo"));
|
do_check_true(headers.hasHeader("fOo"));
|
||||||
do_check_false(headers.hasHeader("not-there"));
|
do_check_false(headers.hasHeader("not-there"));
|
||||||
|
|
||||||
headers.setHeader("f`'~", "bar");
|
headers.setHeader("f`'~", "bar", false);
|
||||||
do_check_true(headers.hasHeader("F`'~"));
|
do_check_true(headers.hasHeader("F`'~"));
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -300,7 +300,7 @@ function run_test()
|
||||||
function override_test_registerdirectory(metadata, response)
|
function override_test_registerdirectory(metadata, response)
|
||||||
{
|
{
|
||||||
response.setStatusLine("1.1", 200, "OK");
|
response.setStatusLine("1.1", 200, "OK");
|
||||||
response.setHeader("Override-Succeeded", "yes");
|
response.setHeader("Override-Succeeded", "yes", false);
|
||||||
|
|
||||||
var body = "success!";
|
var body = "success!";
|
||||||
response.bodyOutputStream.write(body, body.length);
|
response.bodyOutputStream.write(body, body.length);
|
||||||
|
|
|
@ -424,7 +424,7 @@ function authHandler(metadata, response) {
|
||||||
// /auth/ntlm/simple
|
// /auth/ntlm/simple
|
||||||
function authNtlmSimple(metadata, response) {
|
function authNtlmSimple(metadata, response) {
|
||||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||||
response.setHeader("WWW-Authenticate", "NTLM" /* + ' realm="secret"' */);
|
response.setHeader("WWW-Authenticate", "NTLM" /* + ' realm="secret"' */, false);
|
||||||
|
|
||||||
var body = "NOTE: This just sends an NTLM challenge, it never\n" +
|
var body = "NOTE: This just sends an NTLM challenge, it never\n" +
|
||||||
"accepts the authentication. It also closes\n" +
|
"accepts the authentication. It also closes\n" +
|
||||||
|
|
|
@ -154,7 +154,7 @@ function doTest(headerIdx, bodyIdx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createResponse(headerIdx, bodyIdx, metadata, response) {
|
function createResponse(headerIdx, bodyIdx, metadata, response) {
|
||||||
response.setHeader("Content-Type", contentTypeHeaderList[headerIdx][0]);
|
response.setHeader("Content-Type", contentTypeHeaderList[headerIdx][0], false);
|
||||||
response.bodyOutputStream.write(bodyList[bodyIdx][0],
|
response.bodyOutputStream.write(bodyList[bodyIdx][0],
|
||||||
bodyList[bodyIdx][0].length);
|
bodyList[bodyIdx][0].length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,13 +258,13 @@ function rangeHandler(metadata, response) {
|
||||||
var to = (matches[2] === undefined) ? rangeBody.length - 1 : matches[2];
|
var to = (matches[2] === undefined) ? rangeBody.length - 1 : matches[2];
|
||||||
if (from >= rangeBody.length) {
|
if (from >= rangeBody.length) {
|
||||||
response.setStatusLine(metadata.httpVersion, 416, "Start pos too high");
|
response.setStatusLine(metadata.httpVersion, 416, "Start pos too high");
|
||||||
response.setHeader("Content-Range", "*/" + rangeBody.length);
|
response.setHeader("Content-Range", "*/" + rangeBody.length, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
body = body.substring(from, to + 1);
|
body = body.substring(from, to + 1);
|
||||||
// always respond to successful range requests with 206
|
// always respond to successful range requests with 206
|
||||||
response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
|
response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
|
||||||
response.setHeader("Content-Range", from + "-" + to + "/" + rangeBody.length);
|
response.setHeader("Content-Range", from + "-" + to + "/" + rangeBody.length, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.bodyOutputStream.write(body, body.length);
|
response.bodyOutputStream.write(body, body.length);
|
||||||
|
@ -274,7 +274,7 @@ function rangeHandler(metadata, response) {
|
||||||
function redirHandler(metadata, response) {
|
function redirHandler(metadata, response) {
|
||||||
response.setStatusLine(metadata.httpVersion, 302, "Found");
|
response.setStatusLine(metadata.httpVersion, 302, "Found");
|
||||||
response.setHeader("Content-Type", "text/html", false);
|
response.setHeader("Content-Type", "text/html", false);
|
||||||
response.setHeader("Location", metadata.getHeader("X-Redir-To"));
|
response.setHeader("Location", metadata.getHeader("X-Redir-To"), false);
|
||||||
var body = "redirect\r\n";
|
var body = "redirect\r\n";
|
||||||
response.bodyOutputStream.write(body, body.length);
|
response.bodyOutputStream.write(body, body.length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ function runServer()
|
||||||
function serverShutdown(metadata, response)
|
function serverShutdown(metadata, response)
|
||||||
{
|
{
|
||||||
response.setStatusLine("1.1", 200, "OK");
|
response.setStatusLine("1.1", 200, "OK");
|
||||||
response.setHeader("Content-type", "text/plain");
|
response.setHeader("Content-type", "text/plain", false);
|
||||||
|
|
||||||
var body = "Server shut down.";
|
var body = "Server shut down.";
|
||||||
response.bodyOutputStream.write(body, body.length);
|
response.bodyOutputStream.write(body, body.length);
|
||||||
|
@ -203,7 +203,7 @@ function serverShutdown(metadata, response)
|
||||||
function redirect(metadata, response)
|
function redirect(metadata, response)
|
||||||
{
|
{
|
||||||
response.setStatusLine("1.1", 301, "Moved Permanently");
|
response.setStatusLine("1.1", 301, "Moved Permanently");
|
||||||
response.setHeader("Location", metadata.queryString);
|
response.setHeader("Location", metadata.queryString, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -475,7 +475,7 @@ function testListing(metadata, response)
|
||||||
function defaultDirHandler(metadata, response)
|
function defaultDirHandler(metadata, response)
|
||||||
{
|
{
|
||||||
response.setStatusLine("1.1", 200, "OK");
|
response.setStatusLine("1.1", 200, "OK");
|
||||||
response.setHeader("Content-type", "text/html");
|
response.setHeader("Content-type", "text/html", false);
|
||||||
try {
|
try {
|
||||||
if (metadata.path.indexOf("/tests") != 0) {
|
if (metadata.path.indexOf("/tests") != 0) {
|
||||||
regularListing(metadata, response);
|
regularListing(metadata, response);
|
||||||
|
|
|
@ -76,13 +76,13 @@ function run_test()
|
||||||
var to = (matches[2] === undefined) ? data.length - 1 : matches[2];
|
var to = (matches[2] === undefined) ? data.length - 1 : matches[2];
|
||||||
if (from >= data.length) {
|
if (from >= data.length) {
|
||||||
resp.setStatusLine(meta.httpVersion, 416, "Start pos too high");
|
resp.setStatusLine(meta.httpVersion, 416, "Start pos too high");
|
||||||
resp.setHeader("Content-Range", "*/" + data.length);
|
resp.setHeader("Content-Range", "*/" + data.length, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
body = body.substring(from, to + 1);
|
body = body.substring(from, to + 1);
|
||||||
// always respond to successful range requests with 206
|
// always respond to successful range requests with 206
|
||||||
resp.setStatusLine(meta.httpVersion, 206, "Partial Content");
|
resp.setStatusLine(meta.httpVersion, 206, "Partial Content");
|
||||||
resp.setHeader("Content-Range", from + "-" + to + "/" + data.length);
|
resp.setHeader("Content-Range", from + "-" + to + "/" + data.length, false);
|
||||||
}
|
}
|
||||||
resp.bodyOutputStream.write(body, body.length);
|
resp.bodyOutputStream.write(body, body.length);
|
||||||
});
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче