NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Request
NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Request
With Firefox 3.6.13 + NoScript 2.0.9.3 + LiveHTTPHeaders 0.16, an automatic
refresh of a page by issuing a POST request as described below results in 400
Bad Request after the Apache server times out reading the request. The problem
does not occur if either NoScript or LiveHTTPHeaders is deinstalled.
The HTML page that wants to refresh itself contains:
<body onload="timerID=setTimeout('document.mainform.submit()',60000);">
and:
<form method="post" enctype="multipart/form-data" accept-charset="utf-8"
action="https://....." name="mainform"> ..... </form>
The problem occurres only if this form is posted due to the timeout, but not if
it is posted by clicking on any submit button of the form.
If I click on the reload button (with or without the shift key held down) when
the 400 Bad Request is displayed, the error occures again.
I have hacked my Apache server to intercept the decrypted SSL data stream
(output of SSL_read() in modules/ssl/ssl_engine_io.c) into a file for
debugging.
Without LiveHTTPHeaders, the request data stream reads:
##### Begin of interception #####
POST /perMail/cgi/test/permail/1295218173 HTTP/1.1
Host: testxsso.uni-muenster.de
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206
Ubuntu/10.04 (lucid) Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: https://testxsso.uni-muenster.de/perMai ... 1295218112
X-Behavioral-Ad-Opt-Out: 1
X-Do-Not-Track: 1
Content-Type: multipart/form-data;
boundary=---------------------------8685874676609981101567304409
Content-Length: 4670
-----------------------------8685874676609981101567304409
Content-Disposition: form-data; name="what"
refr
-----------------------------8685874676609981101567304409
..... and all the other input fields .....
-----------------------------8685874676609981101567304409--
##### End of interception #####
With LiveHTTPHeaders, the request data stream reads:
##### Begin of interception #####
POST /perMail/cgi/test/permail/1295218471 HTTP/1.1
Host: testxsso.uni-muenster.de
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206
Ubuntu/10.04 (lucid) Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
X-Behavioral-Ad-Opt-Out: 1
X-Do-Not-Track: 1
Referer: https://testxsso.uni-muenster.de/perMai ... 1295218410
##### End of interception #####
As you can see, the Referer line gets moved down and the Content-Type and
Content-Length lines are missing. Also missing are the separator line and all
post data. This causes the Apache server to wait for the separator line until
timeout.
This problem does not occur e.g. when both NoScript and Firebug are installed.
Because Firebug intercepts HTTP headers as well, I assume that LiveHTTPHeaders
and not NoScript makes something wrong hooking itself into Firefox. But it might
be a NoScript bug nevertheless and thus I think you should know of the problem;
and perhaps you have a chance to circumvent it.
(I have posted the same information as bug report on
<https://www.mozdev.org/bugs/show_bug.cgi?id=23626>.)
Thanks for looking into it.
refresh of a page by issuing a POST request as described below results in 400
Bad Request after the Apache server times out reading the request. The problem
does not occur if either NoScript or LiveHTTPHeaders is deinstalled.
The HTML page that wants to refresh itself contains:
<body onload="timerID=setTimeout('document.mainform.submit()',60000);">
and:
<form method="post" enctype="multipart/form-data" accept-charset="utf-8"
action="https://....." name="mainform"> ..... </form>
The problem occurres only if this form is posted due to the timeout, but not if
it is posted by clicking on any submit button of the form.
If I click on the reload button (with or without the shift key held down) when
the 400 Bad Request is displayed, the error occures again.
I have hacked my Apache server to intercept the decrypted SSL data stream
(output of SSL_read() in modules/ssl/ssl_engine_io.c) into a file for
debugging.
Without LiveHTTPHeaders, the request data stream reads:
##### Begin of interception #####
POST /perMail/cgi/test/permail/1295218173 HTTP/1.1
Host: testxsso.uni-muenster.de
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206
Ubuntu/10.04 (lucid) Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: https://testxsso.uni-muenster.de/perMai ... 1295218112
X-Behavioral-Ad-Opt-Out: 1
X-Do-Not-Track: 1
Content-Type: multipart/form-data;
boundary=---------------------------8685874676609981101567304409
Content-Length: 4670
-----------------------------8685874676609981101567304409
Content-Disposition: form-data; name="what"
refr
-----------------------------8685874676609981101567304409
..... and all the other input fields .....
-----------------------------8685874676609981101567304409--
##### End of interception #####
With LiveHTTPHeaders, the request data stream reads:
##### Begin of interception #####
POST /perMail/cgi/test/permail/1295218471 HTTP/1.1
Host: testxsso.uni-muenster.de
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206
Ubuntu/10.04 (lucid) Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
X-Behavioral-Ad-Opt-Out: 1
X-Do-Not-Track: 1
Referer: https://testxsso.uni-muenster.de/perMai ... 1295218410
##### End of interception #####
As you can see, the Referer line gets moved down and the Content-Type and
Content-Length lines are missing. Also missing are the separator line and all
post data. This causes the Apache server to wait for the separator line until
timeout.
This problem does not occur e.g. when both NoScript and Firebug are installed.
Because Firebug intercepts HTTP headers as well, I assume that LiveHTTPHeaders
and not NoScript makes something wrong hooking itself into Firefox. But it might
be a NoScript bug nevertheless and thus I think you should know of the problem;
and perhaps you have a chance to circumvent it.
(I have posted the same information as bug report on
<https://www.mozdev.org/bugs/show_bug.cgi?id=23626>.)
Thanks for looking into it.
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
Most likely LiveHTTPHeaders makes wrong assumptions on the headers order.
Does this happen in latest development build?
If it does, does the problem persist if you set the noscript.doNotTrack.enabled preference to false?
Does this happen in latest development build?
If it does, does the problem persist if you set the noscript.doNotTrack.enabled preference to false?
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
Thanks for your quick response! Both questions: Yes, the problem persists.
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
Even worse to analyze:
It now only happens sometimes, sometimes the document.mainform.submit() is successful.
It now only happens sometimes, sometimes the document.mainform.submit() is successful.
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
I suspect you can make it predictable by executing the following code between each submission:perske wrote:Even worse to analyze:
It now only happens sometimes, sometimes the document.mainform.submit() is successful.
Code: Select all
top.opener.noscriptOverlay.ns.__parent__.DNS._cache.reset()
Could you check whether replacing LHH with HttpFox shows the same behavior?
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
I just replaced <body onload="timerID=setTimeout('document.mainform.target="_self";document.mainform.submit()',<<refresh>>);"> with <body onload="top.opener.noscriptOverlay.ns.__parent__.DNS._cache.reset();timerID=setTimeout('document.mainform.target="_self";document.mainform.submit()',<<refresh>>);">
The error console reports "top.opener is null", and document.mainform.submit() is no longer called (probably due to this error).
How do I execute that code correctly?
The error console reports "top.opener is null", and document.mainform.submit() is no longer called (probably due to this error).
How do I execute that code correctly?
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
( Sorry, <<refresh>> is a placeholder)
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
Ooops, forgot to tell you: that code is meant to be ran in Tools|Error Console, because it's chrome-privileged.perske wrote:How do I execute that code correctly?
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
Yes, exactly; as long as I executed that code (>= 10 tries), reload was successful. When I stopped executing that code, the 4th reload failed again.Giorgio Maone wrote:I suspect you can make it predictable by executing the following code between each submission:perske wrote:Even worse to analyze:
It now only happens sometimes, sometimes the document.mainform.submit() is successful.Code: Select all
top.opener.noscriptOverlay.ns.__parent__.DNS._cache.reset()
No, the problem occurres only withLiveHTTPHeaders, not with HttpFox. I'll add a pointer to this discussion to the LiveHTTPHeaders bug report. Thank you for your great help!Giorgio Maone wrote: If this happens, then likely LHH gets fooled by NoScript's internal redirection machinery, which is however legal: in other words, it makes wrong assumptions on how nsIHTTPChannel instances work.
Could you check whether replacing LHH with HttpFox shows the same behavior?
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
Re: NoScript+LiveHTTPHeaders+JS submit() causes 400 Bad Requ
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 6.1; rv:2.0b10pre) Gecko/20110116 Firefox/4.0b10pre SeaMonkey/2.1b2pre