michael@0: Cu.import("resource://testing-common/httpd.js"); michael@0: michael@0: var server; michael@0: const BUGID = "331825"; michael@0: michael@0: function TestListener() { michael@0: } michael@0: TestListener.prototype.onStartRequest = function(request, context) { michael@0: } michael@0: TestListener.prototype.onStopRequest = function(request, context, status) { michael@0: var channel = request.QueryInterface(Components.interfaces.nsIHttpChannel); michael@0: do_check_eq(channel.responseStatus, 304); michael@0: michael@0: server.stop(do_test_finished); michael@0: } michael@0: michael@0: function run_test() { michael@0: // start server michael@0: server = new HttpServer(); michael@0: michael@0: server.registerPathHandler("/bug" + BUGID, bug331825); michael@0: michael@0: server.start(-1); michael@0: michael@0: // make request michael@0: var channel = michael@0: Components.classes["@mozilla.org/network/io-service;1"]. michael@0: getService(Components.interfaces.nsIIOService). michael@0: newChannel("http://localhost:" + server.identity.primaryPort + "/bug" + michael@0: BUGID, null, null); michael@0: michael@0: channel.QueryInterface(Components.interfaces.nsIHttpChannel); michael@0: channel.setRequestHeader("If-None-Match", "foobar", false); michael@0: channel.asyncOpen(new TestListener(), null); michael@0: michael@0: do_test_pending(); michael@0: } michael@0: michael@0: // PATH HANDLER FOR /bug331825 michael@0: function bug331825(metadata, response) { michael@0: response.setStatusLine(metadata.httpVersion, 304, "Not Modified"); michael@0: }