Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | Cu.import("resource://testing-common/httpd.js"); |
michael@0 | 2 | |
michael@0 | 3 | var httpserv; |
michael@0 | 4 | |
michael@0 | 5 | function TestListener() { |
michael@0 | 6 | } |
michael@0 | 7 | |
michael@0 | 8 | TestListener.prototype.onStartRequest = function(request, context) { |
michael@0 | 9 | } |
michael@0 | 10 | |
michael@0 | 11 | TestListener.prototype.onStopRequest = function(request, context, status) { |
michael@0 | 12 | httpserv.stop(do_test_finished); |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | function run_test() { |
michael@0 | 16 | httpserv = new HttpServer(); |
michael@0 | 17 | |
michael@0 | 18 | httpserv.registerPathHandler("/bug412945", bug412945); |
michael@0 | 19 | |
michael@0 | 20 | httpserv.start(-1); |
michael@0 | 21 | |
michael@0 | 22 | // make request |
michael@0 | 23 | var channel = |
michael@0 | 24 | Components.classes["@mozilla.org/network/io-service;1"]. |
michael@0 | 25 | getService(Components.interfaces.nsIIOService). |
michael@0 | 26 | newChannel("http://localhost:" + httpserv.identity.primaryPort + |
michael@0 | 27 | "/bug412945", null, null); |
michael@0 | 28 | |
michael@0 | 29 | channel.QueryInterface(Components.interfaces.nsIHttpChannel); |
michael@0 | 30 | channel.requestMethod = "POST"; |
michael@0 | 31 | channel.asyncOpen(new TestListener(), null); |
michael@0 | 32 | |
michael@0 | 33 | do_test_pending(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function bug412945(metadata, response) { |
michael@0 | 37 | if (!metadata.hasHeader("Content-Length") || |
michael@0 | 38 | metadata.getHeader("Content-Length") != "0") |
michael@0 | 39 | { |
michael@0 | 40 | do_throw("Content-Length header not found!"); |
michael@0 | 41 | } |
michael@0 | 42 | } |