зеркало из https://github.com/mozilla/pjs.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:
Родитель
35d5c61b0f
Коммит
31bc14fe74
|
@ -50,8 +50,8 @@ const IMAGE_DATA =
|
|||
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
response.setHeader("Content-Type", "text/plain");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setHeader("Cache-Control", "no-cache", false);
|
||||
|
||||
var accept = request.hasHeader("Accept")
|
||||
? request.getHeader("Accept")
|
||||
|
|
|
@ -190,7 +190,7 @@ var objHandler =
|
|||
function functionHandler(metadata, response)
|
||||
{
|
||||
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.host, "localhost");
|
||||
|
|
|
@ -200,12 +200,12 @@ function testHasHeader()
|
|||
{
|
||||
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_false(headers.hasHeader("not-there"));
|
||||
|
||||
headers.setHeader("f`'~", "bar");
|
||||
headers.setHeader("f`'~", "bar", false);
|
||||
do_check_true(headers.hasHeader("F`'~"));
|
||||
|
||||
try
|
||||
|
|
|
@ -300,7 +300,7 @@ function run_test()
|
|||
function override_test_registerdirectory(metadata, response)
|
||||
{
|
||||
response.setStatusLine("1.1", 200, "OK");
|
||||
response.setHeader("Override-Succeeded", "yes");
|
||||
response.setHeader("Override-Succeeded", "yes", false);
|
||||
|
||||
var body = "success!";
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
|
|
|
@ -424,7 +424,7 @@ function authHandler(metadata, response) {
|
|||
// /auth/ntlm/simple
|
||||
function authNtlmSimple(metadata, response) {
|
||||
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" +
|
||||
"accepts the authentication. It also closes\n" +
|
||||
|
|
|
@ -154,7 +154,7 @@ function doTest(headerIdx, bodyIdx) {
|
|||
}
|
||||
|
||||
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],
|
||||
bodyList[bodyIdx][0].length);
|
||||
}
|
||||
|
|
|
@ -258,13 +258,13 @@ function rangeHandler(metadata, response) {
|
|||
var to = (matches[2] === undefined) ? rangeBody.length - 1 : matches[2];
|
||||
if (from >= rangeBody.length) {
|
||||
response.setStatusLine(metadata.httpVersion, 416, "Start pos too high");
|
||||
response.setHeader("Content-Range", "*/" + rangeBody.length);
|
||||
response.setHeader("Content-Range", "*/" + rangeBody.length, false);
|
||||
return;
|
||||
}
|
||||
body = body.substring(from, to + 1);
|
||||
// always respond to successful range requests with 206
|
||||
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);
|
||||
|
@ -274,7 +274,7 @@ function rangeHandler(metadata, response) {
|
|||
function redirHandler(metadata, response) {
|
||||
response.setStatusLine(metadata.httpVersion, 302, "Found");
|
||||
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";
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ function runServer()
|
|||
function serverShutdown(metadata, response)
|
||||
{
|
||||
response.setStatusLine("1.1", 200, "OK");
|
||||
response.setHeader("Content-type", "text/plain");
|
||||
response.setHeader("Content-type", "text/plain", false);
|
||||
|
||||
var body = "Server shut down.";
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
|
@ -203,7 +203,7 @@ function serverShutdown(metadata, response)
|
|||
function redirect(metadata, response)
|
||||
{
|
||||
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)
|
||||
{
|
||||
response.setStatusLine("1.1", 200, "OK");
|
||||
response.setHeader("Content-type", "text/html");
|
||||
response.setHeader("Content-type", "text/html", false);
|
||||
try {
|
||||
if (metadata.path.indexOf("/tests") != 0) {
|
||||
regularListing(metadata, response);
|
||||
|
|
|
@ -76,13 +76,13 @@ function run_test()
|
|||
var to = (matches[2] === undefined) ? data.length - 1 : matches[2];
|
||||
if (from >= data.length) {
|
||||
resp.setStatusLine(meta.httpVersion, 416, "Start pos too high");
|
||||
resp.setHeader("Content-Range", "*/" + data.length);
|
||||
resp.setHeader("Content-Range", "*/" + data.length, false);
|
||||
return;
|
||||
}
|
||||
body = body.substring(from, to + 1);
|
||||
// always respond to successful range requests with 206
|
||||
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);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче