[Zope] bug in DTMLMethod.py / decapitate ?

Maik Jablonski maik.jablonski@uni-bielefeld.de
Fri, 12 Apr 2002 13:07:02 +0200


hi again,

a little test-suite for the header problem... add and run the following python
script, then view test1 and test2 .

context.manage_addDTMLMethod("test1","",
"""Content-type: text/html\n\n<h1>Hello</h1>""")

context.manage_addDTMLMethod("test2","",
"""Content-type: text/html\r\n\r\n<h1>Hello</h1>""")

greetings again,

maik.

On Fri, 12 Apr 2002 12:28:31 +0200 "Maik Jablonski"
<maik.jablonski@uni-bielefeld.de> wrote:

> hi,
> 
> -- the following may only be a problem of linux, but I can't test it against
> windows --
> 
> I've just tried to improve my PHProduct. I wanted to process the returned
> PHP-Headers, so creating images and so on will be possible out of the box.
> 
> I tried to process the PHP-result through the standard
> 'decapitate'-method. But this did not work, because PHP returns headers with
> '\r\n'-newlines, but DTMLMethod.py / 'decapitate' searches only for '\n'. If
> I remember right (feel free to correct me), '\r\n' is a valid newline for
> headers in the HTTP-RFC's. So I would call it a minor bug in 'DTMLMethod.py
> / decapitate'...
> 
> Work-a-round (maybe of interest for others who play with other external
> processors and wonder why headers aren't processed correct):
> 
> yourOutput.replace('\r\n\r\n','\n\n',1) before returning the result to ZOPE.
> 
> greetings, maik.
> 
> p.s.: I will release a new version of PHParser with working headers next
> week.
> 
> -- 
> maik jablonski                    http://www.sachunterricht-online.de
>  universitaet bielefeld          http://www.zfl.uni-bielefeld.de
>   zentrum fuer lehrerbildung    tlph://+49.(0).521.106.4234
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )