[mod_python] mod_python, HTTP headers and CRLF

Gregory Trubetskoy grisha at modpython.org
Mon Jul 10 08:13:21 EST 2000


This is clearly a bug and I'll make sure it's fixed. Thanks for pointing
it out.

Grisha

On Sun, 9 Jul 2000, Michael Ströder wrote:

> HI!
> 
> I experienced some problems with sending HTTP headers. I'm
> generating HTTP header lines separated with \r\n since HTTP standard
> 1.0 says in section 4.2 "Message Headers":
> 
> ----------------------------- snip ------------------------------
>        HTTP-header    = field-name ":" [ field-value ] CRLF
> ----------------------------- snip ------------------------------
> 
> In apache.py class CGIStdout method write() the headers are splitted
> by using \n\n as separator which fails if scripts are sending header
> conform to HTTP specs above. Here's a patch by using \r\n\r\n as
> second possible
> separator:
> 
> ----------------------------- snip ------------------------------
> 395a396,400
> > 
> >             if len(ss) < 2:
> >               # Second try with splitting by using \r\n\r\n as separator
> >               ss = string.split(self.headers, '\r\n\r\n', 1)
> > 
> ----------------------------- snip ------------------------------
> 
> Would be nice if this patch makes its way into the mod_python
> distribution.
> 
> Ciao, Michael.
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
> 




More information about the Mod_python mailing list