[mod_python] mod_python, HTTP headers and CRLF
MichaelStröder
michael at stroeder.com
Sun Jul 9 13:20:20 EST 2000
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.
More information about the Mod_python
mailing list