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

Graham Dumpleton graham.dumpleton at gmail.com
Wed Aug 29 06:12:15 EDT 2007


On 29/08/2007, Sidnei da Silva <sidnei at enfoldsystems.com> wrote:
> ----- Original Message -----
> > Do you get a content length header if you enable the Apache
> > CONTENT_LENGTH output filter?
>
> I haven't actually tried that, but is it really relevant? The fact is that
> what I'm seeing is that Content-Length *and* Content-Type does get properly
> set when the request has a small size, but not when it goes over a certain
> size. I'm suspecting on the 'automatically send the headers on first
> write()' feature, but haven't dug enough to have 100% confidence that is the
> issue.
>
> > Part of the problem may be that output filters in Apache are a
> > resource filter and are only possibly supposed to operate on the
> > actual body content. I'm not sure if resource filters are supposed to
> > be able to operate on headers.
>
> Could be, but that would not explain why it does work for small requests.

But you indicated you were buffering all output so sending headers on
first write shouldn't be different for the two.

The reason for suggesting CONTENT_LENGTH is that it is a filter which
is specifically meant to update headers. As I pointed out it registers
itself as a different type of output filter. There may be something
about the filter type that provides guarantees which the filter type
used by mod_python doesn't. Thus, whether it works for small write may
just be undefined behaviour.

> > The CONTENT_LENGTH output filter for example which does operate on
> > headers, is registered as a protocol filter and not a resource filter.
> >
> > I don't have the time to investigate this now, but might be able to
> > look at what the differences are later and whether you can even set
> > headers in mod_python output filters.
>
> I will give CONTENT_LENGTH a try later this week. Leaving home to attend the
> 3rd PyConBrasil right now.

I'll see if I can work out something from the code you sent in the mean time.

Have fun at PyConBrasil. When you get back you will have to tell me
whether there was any talk about mod_wsgi. ;-)

Graham


More information about the Mod_python mailing list