[Rails] WEBrick, XMLHttpRequest and Firefox
Sam Stephenson
sstephenson at gmail.com
Tue Mar 15 17:33:06 GMT 2005
On Tue, 15 Mar 2005 09:15:35 -0500, Matt Grayson <mattgrayson at utk.edu> wrote:
> I'm running into a really bizarre issue that I can't make heads or tails
> of. I've got a Rails app running under WEBrick, Rails (0.10.1), Ruby
> 1.8.2 on Windows XP. I'm using Peter Cooper's XMLHttp javascript library
> (http://www.feedfab.com/xmljs/xmlhttp.js) to submit a request to the
> server and just having it return a string to the browser. It's pretty
> straightforward and does fine in IE. The problem pops up when I try to
> do XMLHttpRequest from Firefox - at least half the time WEBrick will
> output (in the logs, not to the browser):
>
> "[2005-03-15 09:09:43] ERROR bad Request-Line `'.
> 127.0.0.1 - -[15/Mar/2005:09:06:53 Eastern Standard Time] "" 400 290
>
> The other half of the time, it performs as you would expect. It makes no
> difference whether or not the request is synchronous or asynchronous. If
> anyone has any insight into this, I would be most appreciative. Thanks.
This is a Mozilla bug[1], fixed in 1.8. When POSTing with
XMLHttpRequest, the value of the "Content-length" header isn't
including the trailing newline sent with the post body. One workaround
is to send a "Connection: close" header so that WEBrick won't treat
the stray newline as a second request.
Sam
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=246651
More information about the Rails
mailing list