Created: (MODPYTHON-107) mod_python.publisher shouldn't flush result when written.
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 > Created: (MODPYTHON-107) mod_python.publisher shouldn't flush result when written.




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

    Created: (MODPYTHON-107) mod_python.publisher shouldn't flush result when written.  
Graham Dumpleton (JIRA)


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


 
01-04-06 10:50 PM

mod_python.publisher shouldn't flush result when written.
---------------------------------------------------------

Key: MODPYTHON-107
URL: http://issues.apache.org/jira/browse/MODPYTHON-107
Project: mod_python
Type: Improvement
Components: publisher
Versions: 3.2
Reporter: Graham Dumpleton


In mod_python.publisher, the result returned from a published function is re
turned as the content of the response after it has been converted to a strin
g, using:

req.write(result)

In doing this, the second argument of req.write() is defaulting to '1', whic
h indicates that the output should be flushed immediately.

This fact prevents an output filter like CONTENT_LENGTH being used in conjun
ction with mod_python.publisher.

This output filter will add a content length header to the response, but onl
y if it is able to read the full content the first time the output filter is
 called. Because the output is flushed at this point, the output filter isn'
t able to do that, as it ge
ts called twice. The first time it gets called will be with the actual conte
nt, the second time happens when the handler returns apache.OK and is effect
ively a null output call to force the output filter to be closed off.

If instead the output is written as:

req.write(result,0)

the output will not be flushed immediately and instead will be output in one
 call when apache.OK is returned. There is no loss of efficiency in doing th
is and instead it will actually eliminate a redundant call into the output f
ilter.

For further details of this issue see discussion in:

http://www.mail-archive.com/python-...g/msg00951.html

This makes one wander if there should be a configurable option for mod_pytho
n.psp to tell it not to flush output as well so that CONTENT_LENGTH could be
 used in that case as well. ???






[ Post a follow-up to this message ]



    Re: Created: (MODPYTHON-107) mod_python.publisher shouldn't flush result when written.  
Graham Dumpleton


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


 
01-07-06 07:46 AM


On 05/01/2006, at 3:15 PM, Gregory (Grisha) Trubetskoy wrote:

>
> On Wed, 4 Jan 2006, Graham Dumpleton (JIRA) wrote:
> 
>
> I kinda mentioned this in the previous e-mail - PSP always does not
> flush output, in fact that 0/1 argument was added to req.write() just
> for PSP. So for pure PSP pages, content-length _should_ work (haven't
> tested it).

Unfortunately, the CONTENT_LENGTH output filter does not in fact work
with PSP.

The reason is that although each individual req.write() doesn't flush,
the PSP code itself does an explicit flush after running the generated
page code.

exec code in global_scope
req.flush()

For it to work, the req.flush() call would have to be removed.

Graham







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:54 PM.      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