Author martin.panter
Recipients Susumu Koshiba, deronnax, martin.panter, r.david.murray, spaceone
Date 2016-06-05.01:51:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1465091490.2.0.118246569871.issue25738@psf.upfronthosting.co.za>
In-reply-to
Content
I think it would be unusual to have different error handling for GET vs HEAD, given HEAD is supposed to be exactly like GET but without a body. On the other hand, see SimpleHTTPRequestHandler.send_head() for an example of calling send_error(NOT_FOUND) for both GET and HEAD. Both Content-Length and Content-Type are for the would-be error message body:

HEAD /nonexistant HTTP/1.0

HTTP/1.0 404 File not found
Server: SimpleHTTP/0.6 Python/3.5.1
Date: Sun, 05 Jun 2016 01:40:55 GMT
Content-Type: text/html;charset=utf-8
Connection: close
Content-Length: 469

Removing Content-Length (and arguably also Content-Type) for HEAD would be an unwanted change in behaviour IMO. Instead, perhaps you would prefer to document that equivalent calls to send_error() should be made for HEAD and GET responses?

A separate 2.7 patch would be helpful (the filenames are different for a start, and the code is slightly different; I don’t think there is any Content-Length added). But I doubt a patch for 3.5 will be worthwhile. Instead, I will probably just apply your 3.6 patch to 3.5 and then merge forward.
History
Date User Action Args
2016-06-05 01:51:30martin.pantersetrecipients: + martin.panter, r.david.murray, deronnax, spaceone, Susumu Koshiba
2016-06-05 01:51:30martin.pantersetmessageid: <1465091490.2.0.118246569871.issue25738@psf.upfronthosting.co.za>
2016-06-05 01:51:30martin.panterlinkissue25738 messages
2016-06-05 01:51:29martin.pantercreate