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 xiang.zhang
Recipients xiang.zhang
Date 2016-03-17.07:42:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458200556.85.0.71774056033.issue26578@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-03-17 07:42:36xiang.zhangsetrecipients: + xiang.zhang
2016-03-17 07:42:36xiang.zhangsetmessageid: <1458200556.85.0.71774056033.issue26578@psf.upfronthosting.co.za>
2016-03-17 07:42:36xiang.zhanglinkissue26578 messages
2016-03-17 07:42:36xiang.zhangcreate