[ 
https://issues.apache.org/jira/browse/MODPYTHON-107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Graham Dumpleton closed MODPYTHON-107.
--------------------------------------


> mod_python.publisher shouldn't flush result when written.
> ---------------------------------------------------------
>
>                 Key: MODPYTHON-107
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-107
>             Project: mod_python
>          Issue Type: Improvement
>          Components: publisher
>    Affects Versions: 3.2.7
>            Reporter: Graham Dumpleton
>         Assigned To: Graham Dumpleton
>             Fix For: 3.3
>
>         Attachments: MP107_20060308_grahamd_1.diff
>
>
> In mod_python.publisher, the result returned from a published function is 
> returned as the content of the response after it has been converted to a 
> string, using:
>   req.write(result)
> In doing this, the second argument of req.write() is defaulting to '1', which 
> indicates that the output should be flushed immediately.
> This fact prevents an output filter like CONTENT_LENGTH being used in 
> conjunction with mod_python.publisher.
> This output filter will add a content length header to the response, but only 
> 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 gets called twice. The first time it gets called will 
> be with the actual content, the second time happens when the handler returns 
> apache.OK and is effectively 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 this 
> and instead it will actually eliminate a redundant call into the output 
> filter.
> For further details of this issue see discussion in:
>   http://www.mail-archive.com/python-dev@httpd.apache.org/msg00951.html
> This makes one wander if there should be a configurable option for 
> mod_python.psp to tell it not to flush output as well so that CONTENT_LENGTH 
> could be used in that case as well. ???

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to