[mod_python] Headers not being sent when input/output is over a certain size

Graham Dumpleton graham.dumpleton at gmail.com
Tue Aug 28 23:32:20 EDT 2007


On 29/08/2007, Sidnei da Silva <sidnei at enfoldsystems.com> wrote:
> Hi there,
>
> I'm writing an Output Filter using mod_python and facing an intriguing
> issue.
>
> When my input/output is over a certain size, the Content-Type/Content-Length
> headers are not set. Anything below that size works fine.
>
> I'm using mod_python 3.3.1 with Apache 2.2.4 on both Windows and Linux with
> the same behaviour.
>
> The input size is roughly 7.5Kb and the generated output is roughly 13.5Kb.
> The only difference between a working request and a non-working request is
> the
> size. It smells to me like there's some buffer flushing going on before I
> set
> Content-Length/Content-Type.
>
> Is this a known-issue? If not, how can I help diagnose it?

If you expect to be able to set headers in an output filter based on
the complete content being output, you need to buffer up all your data
and write it in one go after you have updated the headers. You cannot
write the data and then update the headers.

Without seeing the code for your output filter, can't comment further
as to what the problem may be.

Graham


More information about the Mod_python mailing list