2020-04-07 19:00:03 +03:00
|
|
|
"use strict";
|
|
|
|
|
2019-01-17 21:18:31 +03:00
|
|
|
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
2006-12-15 05:13:54 +03:00
|
|
|
|
2006-06-23 04:49:40 +04:00
|
|
|
var server;
|
2007-05-13 21:09:52 +04:00
|
|
|
const BUGID = "331825";
|
2006-06-23 04:49:40 +04:00
|
|
|
|
|
|
|
function TestListener() {}
|
2019-02-28 02:41:54 +03:00
|
|
|
TestListener.prototype.onStartRequest = function(request) {};
|
|
|
|
TestListener.prototype.onStopRequest = function(request, status) {
|
2006-06-23 04:49:40 +04:00
|
|
|
var channel = request.QueryInterface(Ci.nsIHttpChannel);
|
|
|
|
Assert.equal(channel.responseStatus, 304);
|
|
|
|
|
2009-04-16 00:19:35 +04:00
|
|
|
server.stop(do_test_finished);
|
2006-06-23 04:49:40 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
function run_test() {
|
|
|
|
// start server
|
2012-08-14 18:06:04 +04:00
|
|
|
server = new HttpServer();
|
2006-12-15 05:13:54 +03:00
|
|
|
|
|
|
|
server.registerPathHandler("/bug" + BUGID, bug331825);
|
|
|
|
|
2013-07-19 21:19:28 +04:00
|
|
|
server.start(-1);
|
2006-06-23 04:49:40 +04:00
|
|
|
|
|
|
|
// make request
|
2015-12-19 00:31:16 +03:00
|
|
|
var channel = NetUtil.newChannel({
|
|
|
|
uri: "http://localhost:" + server.identity.primaryPort + "/bug" + BUGID,
|
|
|
|
loadUsingSystemPrincipal: true,
|
|
|
|
});
|
2006-06-23 04:49:40 +04:00
|
|
|
|
|
|
|
channel.QueryInterface(Ci.nsIHttpChannel);
|
|
|
|
channel.setRequestHeader("If-None-Match", "foobar", false);
|
2019-02-12 19:08:25 +03:00
|
|
|
channel.asyncOpen(new TestListener());
|
2006-06-23 04:49:40 +04:00
|
|
|
|
|
|
|
do_test_pending();
|
|
|
|
}
|
2006-12-15 05:13:54 +03:00
|
|
|
|
|
|
|
// PATH HANDLER FOR /bug331825
|
|
|
|
function bug331825(metadata, response) {
|
|
|
|
response.setStatusLine(metadata.httpVersion, 304, "Not Modified");
|
|
|
|
}
|