| From | Sent On | Attachments |
|---|---|---|
| Chris Savery | Aug 17, 2008 12:13 am | |
| Igor Sysoev | Aug 17, 2008 12:23 am | |
| Chris Savery | Aug 17, 2008 6:40 am | |
| Chris Savery | Aug 17, 2008 6:53 am | |
| Igor Sysoev | Aug 17, 2008 6:56 am | |
| Igor Sysoev | Aug 17, 2008 6:58 am | |
| Chris Savery | Aug 17, 2008 5:03 pm | |
| Caesar Indra | Aug 17, 2008 9:00 pm | |
| Rocky Zhang | Nov 28, 2008 12:46 am | |
| Igor Sysoev | Nov 28, 2008 1:04 am | |
| Rocky Zhang | Nov 28, 2008 7:26 am | |
| Rocky Zhang | Nov 28, 2008 7:50 am | |
| Igor Sysoev | Nov 28, 2008 7:55 am | |
| Rocky Zhang | Nov 28, 2008 6:14 pm | |
| Dave Cheney | Dec 1, 2008 6:34 am | |
| Igor Sysoev | Dec 1, 2008 6:38 am | |
| Rocky Zhang | Dec 1, 2008 8:33 am | |
| Dave Cheney | Dec 1, 2008 4:35 pm | |
| Mark Moseley | Dec 1, 2008 5:08 pm | |
| Igor Sysoev | Dec 2, 2008 1:24 am | .Other |
| Loren D. | Dec 15, 2011 4:28 pm | |
| Loren D. | Dec 15, 2011 4:29 pm |
| Subject: | Re: 411 Length Required error | |
|---|---|---|
| From: | Chris Savery (chri...@public.gmane.org) | |
| Date: | Aug 17, 2008 5:03:41 pm | |
| List: | ru.sysoev.nginx | |
Ok. I used Wireshark and tracked this down. I'm posting here so that others will know why this happens. It is a result of poor behaviour in Firebug.
In fact, if you click on the log tab to view request data and headers then Firebug actually re-submits the POST data a second (hidden) time to provide data to show you. Of course, since POST methods will update server data and could insert new database rows this is very bad of Firebug. It is treating the POST like a GET in this case where it should have logged the original POST reply data instead. I have posted a bug in their google group and hopefully someday they will give it some attention.
When Firebug submits the second time it does NOT include the Content-Length header as it did at first, but it shows as though it did. This is why my page was correctly updated but an 411 error was shown in the Firebug log. The original response was not saved and the error was from the repeated POST request.
Just something for people to be aware of.
Chris :)
Igor Sysoev wrote:
On Sun, Aug 17, 2008 at 08:40:39PM +0700, Chris Savery wrote:
Thanks Igor.
I turned on info and it says the reason is client didn't send "Content-Length" header. Now, why would Firefox (3) not do that? Is this common?
I noticed in Firebug that the header sent ALSO has "Transfer-Encoding: chunked". I had the same problem with Lightpd and using a Flash uploader but they refuse to fix it to ignore chunked, so I could not use it with Flash. One reason I switched to using nginx is that unlike Lighttpd it works with the flash uploader.
So should I just ignore this as it still works as expected? But I cannot see content in Firebug, or maybe I need to force a header in JS code (maybe the mootools JS library mistakenly doesn't set the Content Length hmm, I should explore that too.) Just a minefield. How is it that the server returns this error page but also I am getting the JSON data back as well?
nginx tests Content-Length absence before Transfer-Encoding, thus it logs this error, although the request is valid: it has either Transfer-Encoding or Content-Length.
Igor Sysoev wrote:
On Sun, Aug 17, 2008 at 02:14:18PM +0700, Chris Savery wrote:
I've been getting this error a lot in my testing. I never received it with Apache. I understand what the message say but not why it's coming about. My headers being sent have length. Or is this message referring to content returned by PHP at the server end? I'm sure one of you experts here knows what's going on with this. I only get it on POST requests and not most of my ajax calls (which are GET).
Thanks for any help with tracking this down. I'm seeing it in Firebug and when it occurs I cannot see the real response content - even though content is indeed returned as well since it has effect on my javascript code and updates the screen. Weird. Chris :)
Set error_log level to info:
error_log /path/to/log info;
Then nginx will log a reason. Now there are 3 reasons:
"client sent invalid "Content-Length" header" "client sent ... method without "Content-Length" header" "client sent "Transfer-Encoding: chunked" header"
The last reason is nginx feature: it still does not support chunked body.
Response from server:
<html>
<head><title>411 Length Required</title></head>
<body bgcolor="white">
<center><h1>411 Length Required</h1></center>
<hr><center>nginx/0.6.32</center>
</body>
</html>
Header sent to server using ajax (only removed some identity info, HOST line):
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1 Accept text/javascript, text/html, application/xml, text/xml, */* Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive X-Requested-With XMLHttpRequest Content-Type application/x-www-form-urlencoded; charset=utf-8 Referer http://www.xxxxx.com/ Content-Length 269 Cookie ZZZZSession=3ce34bb3dbc257ff61405175f941f1d7 Pragma no-cache Cache-Control no-cache






.Other