Message261898
BaseHTTPRequestHandler in http.server supports HTTP/0.9. But the response for HTTP/0.9 request is implemented wrong.
Response of HTTP/0.9 request returns message body directly without status line and headers. But if you inherit BaseHTTPRequestHandler and set the default_request_version to "HTTP/1.x", then self.request_version can never be "HTTP/0.9" since in the https://hg.python.org/cpython/file/tip/Lib/http/server.py#l315 branch it does not set version to "HTTP/0.9" and then always sends the status line and headers back.
A trivial patch can fix this problem that set version to "HTTP/0.9" in the branch. But this will cause some failure in tests. The tests in test_httpservers use http.client.HTTPConnection to send and receive HTTP message. But since 3.4, HTTPConnection doesn't support HTTP/0.9-style simple responses. We can use it to test HTTP/0.9 connection if the server is implemented in the right way.
And since http.client.HTTPConnection has dropped the support for HTTP/0.9, is it reasonable to drop the support in http.server too? |
|
Date |
User |
Action |
Args |
2016-03-17 07:42:36 | xiang.zhang | set | recipients:
+ xiang.zhang |
2016-03-17 07:42:36 | xiang.zhang | set | messageid: <1458200556.85.0.71774056033.issue26578@psf.upfronthosting.co.za> |
2016-03-17 07:42:36 | xiang.zhang | link | issue26578 messages |
2016-03-17 07:42:36 | xiang.zhang | create | |
|