This seems to be the way to do it. So far you are following the header format correctly.
Here is someone else who asked the same question, more or less.
Returning http status codes in Python CGI
Do you use HTTP specifications when printing a status code? Can you try to print only the status code, not its description?
Maybe like ...
print '''Status:501 Content-type: text/html '''
Or it should be like ...
print '''HTTP/1.1 501 Not Implemented Content-type: text/html '''
Could you check your installation to check?
Return status from CGI:
http://oreilly.com/openbook/cgi/ch03_07.html
I assume that “Status: 501 is not implemented”, as if it were originally, this is the way to go. I do not know why it does not work. Do you print content without a title before printing a status code?
Another source that confirms that you are doing it right (see section 6.3.3.):
http://www.ietf.org/rfc/rfc3875
EDIT 1,2,3: extended answer
source share