[mod_python] Re: Chunked encoding

Mike Looijmans nlv11281 at natlab.research.philips.com
Tue Feb 21 01:36:53 EST 2006


> As to the connection between req.set_content_length() and how much data
> you write, there isn't really any. Calling req.set_content_length()  
> only has the
> effect of setting the "Content-Length" response header. You could set  the
> content length to a small value and write more data that you say  there 
> will be
> and mod_python/Apache will quite happily let you do it. A remote  client on
> the other handle may well probably discard any extra content if it  
> honours the
> content length header.

Probably, the client will sort of choke and close the connection in 
order to resync. What will really happen depends on your data. If you 
send something out that looks like a HTTP response header there, the 
client may think you're responding to its next request. Yes, it's a good 
way to start spoofing and hacking.

So in a word: Don't. Only output the length header if you're 100% sure 
that the length is correct - it is NOT an estimation, it has to be exact.

Mike.



More information about the Mod_python mailing list