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

Graham Dumpleton graham.dumpleton at gmail.com
Sun Feb 15 20:42:32 EST 2009


2009/2/16 Joerg <jerch at rockborn.de>:
> hello,
>
> ive dumped a fileupload (original size = 231KB) with the following results:
>
> without filter:
>        - req.read() --> 231KB
>        - req.readline() --> 231KB
>        - req.readline(64000) --> 231KB
>        - via util.py --> 231KB
>
> with filter:
>        - req.read() --> 231KB
>        - req.readline() --> 231KB
>        - req.readline(64000) --> 64KB

What about:

  s = req.readline(64000)
  while not s:
    ...
    # log some debug ....
    s = req.readline(64000)

Does that result in all data being read, or is that what your test was doing?

Corresponding to this, log inside of the filter when the filter is
entered/exited and how much each read() request yields so can see in
what way blocks of data are being passed from ealier input filters.

Note that an input filter is called multiple times. It doesn't provide
all data in one execution. This is why I want to see the relationship
between each read from handler and what happens in the filter.

Graham

>        - via util.py --> 64KB
>
> the filter:
> def inputfilter(filter):
>        s = filter.read()
>        while s:
>                filter.write(s)
>                s = filter.read()
>        if s is None:
>                filter.close()
>
> somehow the the req.readline(size) method doesnt like input filters. since i
> tested it with a binary file the file content would be in one line, but the
> unread part of this line gets lost. weird thing, but all the other lines
> after the file content (the closing boundery) gets lost, too.
> this problem points definitely into the c-written part of mod_python, util.py
> just inherits it from there.
> any suggestions?
>
> jerch
>


More information about the Mod_python mailing list