[mod_python] 411 Length Required for POST

Deron Meranda deron.meranda at gmail.com
Fri Mar 3 12:41:44 EST 2006

On 3/3/06, John Ruff <jcruff at gmail.com> 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.

Are you by any chance sending a "chunked" transfer-encoding?
Are you sending a large amount of data?

mod_python's FieldStorage classes specifically require a Content-Length
header when decoding a POST request (and hence can't decode a
chunked request body).

You may try bumping down to HTTP/1.0 rather than HTTP/1.1, which
should prevent your request from being chunked.
Deron Meranda

More information about the Mod_python mailing list