[mod_python] in modpython ,how to restrict the upload file size?

Graham Dumpleton graham.dumpleton at gmail.com
Sat Mar 31 00:28:41 EST 2007


On 31/03/07, Martin Šenkeřík <martinsenkerik at email.cz> wrote:
>
> This solution works fine only for Opera web browser for me. Others (I've
> tested Firefox and IE6) continues with transfer. In http specification is
> about "413: Request Entity Too Large" among others written:
>
> "The server MAY close the connection to prevent the client from continuing
> the request."
>
> I was trying to find way, how force client to stop the transfer and to
> redirect them to some explanation page. But with no result. Do you have
> any ideas? Or is it possible, that problem is somewhere else? e.g. wrong
> configuration of Apache, mod_python...?
>
> (using Apache/2.2.3, mod_python/3.3.1 Python/2.4.4 on Debian)

See:

 http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html

Especially section 8.2.3

It all depends on whether the browser is using HTTP/1.1 and whether it
is sending an Expect header with value 100-continue and subsequently
waiting for a 100 continue response before sending the content.

If it isn't then the client would be sending the content anyway and
once it does you can't stop it.

Thus, on your server side dump out to the log what headers are being
sent by client and see what browsers are sending the Expect header and
which aren't.

I don't know how you might tell the browser to use this.

Graham



More information about the Mod_python mailing list