This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Yoav.Weiss
Recipients Yoav.Weiss, orsenthil, petri.lehtinen
Date 2011-07-04.10:52:44
SpamBayes Score 8.532031e-08
Marked as misclassified No
Message-id <CAKrZ8V12Gomxn6O9AND=tVnvAKmrH2+Z=wmpYqkgtPFNy1de1g@mail.gmail.com>
In-reply-to <1309722358.59.0.944617906049.issue12439@psf.upfronthosting.co.za>
Content
Thanks for correcting me. I guess I assumed that the "message" variable is
an HTTPMessage.
Is send_response documented somewhere? I failed to find a reference.

On Sun, Jul 3, 2011 at 9:45 PM, Petri Lehtinen <report@bugs.python.org>wrote:

>
> Petri Lehtinen <petri@digip.org> added the comment:
>
> It seems to me that you're indeed misusing it.
>
> The correct way would be something like this (assuming response is a
> HTTPResponse object from httplib):
>
> self.send_response(response.status)
> for name, value in response.getheaders():
>    self.send_header(name, value)
> self.end_headers()
>
> This is because send_response's second argument is the HTTP's "reason"
> field, i.e. invoking:
>
>    self.send_response(123, 'FOOBAR')
>
> results in
>
>    HTTP/1.1 123 FOOBAR\r\n
>
> to be sent, followed by "Server" and "Date" headers. The second argument is
> not meant to be used for sending headers.
>
> (When the second argument is omitted, a standard reason for the given
> status code is used.)
>
> ----------
> nosy: +petri.lehtinen
> resolution:  -> invalid
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue12439>
> _______________________________________
>
Files
File name Uploaded
unnamed Yoav.Weiss, 2011-07-04.10:52:44
History
Date User Action Args
2011-07-04 10:52:45Yoav.Weisssetrecipients: + Yoav.Weiss, orsenthil, petri.lehtinen
2011-07-04 10:52:44Yoav.Weisslinkissue12439 messages
2011-07-04 10:52:44Yoav.Weisscreate