Message267361
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. |
|
Date |
User |
Action |
Args |
2016-06-05 01:51:30 | martin.panter | set | recipients:
+ martin.panter, r.david.murray, deronnax, spaceone, Susumu Koshiba |
2016-06-05 01:51:30 | martin.panter | set | messageid: <1465091490.2.0.118246569871.issue25738@psf.upfronthosting.co.za> |
2016-06-05 01:51:30 | martin.panter | link | issue25738 messages |
2016-06-05 01:51:29 | martin.panter | create | |
|