2012-08-14 07:06:04 -07:00
|
|
|
Cu.import("resource://testing-common/httpd.js");
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
var server;
|
2007-05-13 10:09:52 -07:00
|
|
|
const BUGID = "331825";
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
function TestListener() {
|
|
|
|
}
|
|
|
|
TestListener.prototype.onStartRequest = function(request, context) {
|
|
|
|
}
|
|
|
|
TestListener.prototype.onStopRequest = function(request, context, status) {
|
|
|
|
var channel = request.QueryInterface(Components.interfaces.nsIHttpChannel);
|
|
|
|
do_check_eq(channel.responseStatus, 304);
|
|
|
|
|
2009-04-15 13:19:35 -07:00
|
|
|
server.stop(do_test_finished);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function run_test() {
|
|
|
|
// start server
|
2012-08-14 07:06:04 -07:00
|
|
|
server = new HttpServer();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
server.registerPathHandler("/bug" + BUGID, bug331825);
|
|
|
|
|
2013-07-19 10:19:28 -07:00
|
|
|
server.start(-1);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// make request
|
|
|
|
var channel =
|
|
|
|
Components.classes["@mozilla.org/network/io-service;1"].
|
|
|
|
getService(Components.interfaces.nsIIOService).
|
2013-07-19 10:19:28 -07:00
|
|
|
newChannel("http://localhost:" + server.identity.primaryPort + "/bug" +
|
|
|
|
BUGID, null, null);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
channel.QueryInterface(Components.interfaces.nsIHttpChannel);
|
|
|
|
channel.setRequestHeader("If-None-Match", "foobar", false);
|
|
|
|
channel.asyncOpen(new TestListener(), null);
|
|
|
|
|
|
|
|
do_test_pending();
|
|
|
|
}
|
|
|
|
|
|
|
|
// PATH HANDLER FOR /bug331825
|
|
|
|
function bug331825(metadata, response) {
|
|
|
|
response.setStatusLine(metadata.httpVersion, 304, "Not Modified");
|
|
|
|
}
|