cgi problem

Kent Johnson kent at kentsjohnson.com
Thu Mar 9 13:42:41 CET 2006


Paul Rubin wrote:
> Tim Roberts <timr at probo.com> writes:
> 
>>Yes, but the CGI module doesn't write anything, so the advice of writing a
>>"Location:" header still applies.
> 
> 
> Aha, it's coming from CGIHTTPServer.py:CGIHTTPRequestHandler.run_cgi()
> where it says
> 
>         self.send_response(200, "Script output follows")
> 
> I got the two modules confused.  This still leaves me with the same
> basic problem, how to suppress the sending of that header.

Ah, now I get it. This does look like a bug in CGIHTTPServer to me. As 
you note, it hardcodes the 200 status response. The CGI spec says that 
the CGI program can use the Status: header to tell the server what 
status code to send but CGIHTTPServer doesn't do that.

ISTM the spec requires the server to buffer and interpret the HTTP 
headers from the CGI so the Status header can be set based on the CGI 
response.



More information about the Python-list mailing list