[mod_python] problem with input filter and POST data (fileupload)

Joerg jerch at rockborn.de
Sat Feb 14 17:49:30 EST 2009


Hi,

I ve encountered a problem with a POST request while a mod_python input filter 
is running (on ubuntu 8.04 with apache 2.2.8 prefork and mod_python 3.3.1).

the situation:
Imagine the simplest input filter as stated in the docs and try to upload a 
file (some big POST data) thru this filter. This file will be trunceated to 
the first 64k.

i have tracked down the problem to fragmented data handling in the file 
util.py. If i change line 363 in that file from
>>> req.readline(readBlockSize)
to
>>> req.readline()
it works again. so i dumped the stream data here to see wots going on 
with the data with 4 different setups:

1) req.readline() without filter
2) req.readline() with filter
3) req.readline(readBlockSize) without filter
4) req.readline(readBlockSize) with filter

1-3 seem to be exactly the same, while in the 4th case the req-stream is empty 
after some readings (then req.readline(readBlockSize) becomes None and the 
method returns as expected).
I dont know why suddenly the stream is empty long before the boundery (or 
readline() thinks so), could this be some delay effect caused by the filter? 
or is this a special behavior by req.readline() itself with a given length?

If this is not easy to patch, will there be any neg. effect of using 
req.readline() instead of req.readline(readBlockSize) aside from the big file 
problem?

Regards, joerg


More information about the Mod_python mailing list