[mod_python] 411 Length Required for POST

Nick nick at dd.revealed.net
Fri Mar 3 14:16:27 EST 2006


Hmm.... in my experience, XMLHttpRequest() automagically puts the
content-length header in based on the size of whatever is passed in send().
 You shouldn't have to explicitly specify a content-length, and I would
think that if you did it would get overridden.

Nick

John Ruff wrote:
> Thanks, actually I'm already using x-www-form-urlencoded originally as a
> test to confirm the header was being set with XMLHtttpRequest's
> setRequestHeader() method (which is it).  But for whatever reason the
> Content-Length is not being set in the POST header.
> 
> ___________________
> John Ruff
> jcruff at gmail.com
> 
> "No one can see past a choice they don't understand." --The Oracle
> 
> 
> 
> On Mar 3, 2006, at 1:32 PM, Nick wrote:
> 
>> Also of note, FieldStorage will raise HTTP_NOT_IMPLEMENTED if the
>> content-type is not x-www-form-urlencoded or a multipart, which you may
>> discover after solving the content-length problem.
>>
>> Nick
>>
>> John Ruff wrote:
>>>  I'm using a XMLHttpRequest to send a POST to a mod_python script, but
>>> I'm getting "HTTP/1.x 411 Length Required" back to the browser.  I've
>>> set the 'Content-Length' with my XMLHttpRequest object using
>>> [code]request.setRequestHeader('Content-Length', '0')[/code] but doesn't
>>> work, this doesn't happen when posting to a php script.  I'm using
>>> mod_python.publisher as my handler.  Any ideas?
>>



More information about the Mod_python mailing list