2012-08-14 18:06:04 +04:00
|
|
|
Cu.import("resource://testing-common/httpd.js");
|
2015-12-22 03:29:26 +03:00
|
|
|
Cu.import("resource://gre/modules/NetUtil.jsm");
|
2008-10-01 09:31:24 +04:00
|
|
|
|
|
|
|
var httpserv;
|
|
|
|
|
|
|
|
function TestListener() {
|
|
|
|
}
|
|
|
|
|
|
|
|
TestListener.prototype.onStartRequest = function(request, context) {
|
|
|
|
}
|
|
|
|
|
|
|
|
TestListener.prototype.onStopRequest = function(request, context, status) {
|
2009-04-16 00:19:35 +04:00
|
|
|
httpserv.stop(do_test_finished);
|
2008-10-01 09:31:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function run_test() {
|
2012-08-14 18:06:04 +04:00
|
|
|
httpserv = new HttpServer();
|
2008-10-01 09:31:24 +04:00
|
|
|
|
|
|
|
httpserv.registerPathHandler("/bug412945", bug412945);
|
|
|
|
|
2013-07-19 21:19:28 +04:00
|
|
|
httpserv.start(-1);
|
2008-10-01 09:31:24 +04:00
|
|
|
|
|
|
|
// make request
|
2015-12-22 03:29:26 +03:00
|
|
|
var channel = NetUtil.newChannel({
|
|
|
|
uri: "http://localhost:" + httpserv.identity.primaryPort + "/bug412945",
|
|
|
|
loadUsingSystemPrincipal: true
|
|
|
|
});
|
2008-10-01 09:31:24 +04:00
|
|
|
|
|
|
|
channel.QueryInterface(Components.interfaces.nsIHttpChannel);
|
2014-03-18 20:36:18 +04:00
|
|
|
channel.requestMethod = "POST";
|
2015-12-22 03:29:26 +03:00
|
|
|
channel.asyncOpen2(new TestListener(), null);
|
2008-10-01 09:31:24 +04:00
|
|
|
|
|
|
|
do_test_pending();
|
|
|
|
}
|
|
|
|
|
|
|
|
function bug412945(metadata, response) {
|
|
|
|
if (!metadata.hasHeader("Content-Length") ||
|
|
|
|
metadata.getHeader("Content-Length") != "0")
|
|
|
|
{
|
|
|
|
do_throw("Content-Length header not found!");
|
|
|
|
}
|
|
|
|
}
|