Re: Created: (MODPYTHON-105) mod_python.publisher shouldnotdiscard content for HEAD re
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Re: Created: (MODPYTHON-105) mod_python.publisher shouldnotdiscard content for HEAD re




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: Created: (MODPYTHON-105) mod_python.publisher shouldnotdiscard content for HEAD re  
Graham Dumpleton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-05-06 07:46 AM

Grisha wrote ..
>
> On Wed, 4 Jan 2006, Graham Dumpleton wrote:
> 
>
> Yep.
> 
>
> Hmmm... This needs some more research. i.e. I don't quite completely
> understand why the CONTENT_LENGTH filter can only count bytes when there
> is no flush() (shortcoming of CONTENT_LENGTH or an impossibility?)...

The content length header has to be added before CONTENT_LENGTH
tries to write output from the first call into it. Thus if it doesn't detect
end of content in that first call it can't add the content length header.
It will not buffer input itself and has to write out data before it returns
from each call.

> Implicit buffering would be a significant change - if someone used
> req.write() to generate "dynamic" content (e.g. output from one of those
> traceroute sites being sent in real time), they'd be very surprised to
> not
> see the output anymore. CGI I think flushes implicitely at every end of
> line which where this behaviour comes from...
>
> On the other hand implicit flush slows things down tremenduosly when you
> have lots of req.write()s, this was discovered when PSP was added and
> that's when the no-flush argument was introduced, so if backwards
> compatibility was of no concern, I'd make implicit buffering (i.e.
> no-flush) default.

Not suggesting changing req.write() default, purely that one call of it
in mod_python.publisher(). In the case where the only content is that
returned by the publisher function, the full content is held at that point
in a single string and there will be no more later on. Thus no harm in
that one case of telling req.write() not to flush, since the next thing
mod_python.publisher will do is return apache.OK anyway, which will
cause it t be flushed anyway, but with the side effect that any output
filter will be able to detect end of content in the one call.

As to PSP flushing, you are right. I looked at the code, saw stuff like:

STATIC_STR("req.write(\"\"\"")

and misinterpreted it since I didn't see a "0" at that point. Didn't
realise it was the start of a multiline string with later:

STATIC_STR("\"\"\",0);

> And thanks for all your help BTW :-)

I thought at this point you would be getting sick of me finding all this
bugs and suggested improvements. I have managed to delay you getting
version 3.2 final out now a few times.

Anyway, all an interesting exercise digging into all of this. Maybe one
day I'll know enough about it to contemplate writing a book. ;-)

Graham






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:04 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register