On Jul 23, 2008, at 5:27 PM, Sergey Schetinin wrote:

> Here's a snippet from paste.httpserver
>
> try:
>                content_length = int(self.headers.get('Content- 
> Length', '0'))
>            except ValueError:
>                content_length = 0
>            if not hasattr(self.connection, 'get_context'):
>                rfile = LimitedLengthFile(rfile, content_length)
>
> This means that if there's no Content-Length request header the
> request body would not be available anyway (cropped to zero length).
> If you're using paste.httpserver you can just write middleware to
> reject requests with Content-Length too big. I'd recommend using WebOb
> as it would make this task rather trivial (under 10 lines of code I
> think).

hey.....that would work !   I didn't pick up earlier that  
LimitedLengthFile cuts off at the length given.

This would probably be a good replacement for that given in the Pylons  
recipe (also don't need the cgi.maxlen either...which is not well  
documented).



_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users

Reply via email to