Repository navigation
Remove HTTP 0.9 server support #54930
Copy link
Copy link
Closed
Labels
3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = None
created_at = <Date 2010-12-16.18:21:42.506>
labels = ['3.7', 'type-bug', 'library']
title = 'Remove HTTP 0.9 server support'
updated_at = <Date 2016-11-24.03:10:59.340>
user = 'https://github.com/pitrou'bugs.python.org fields:
activity = <Date 2016-11-24.03:10:59.340>
actor = 'martin.panter'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2010-12-16.18:21:42.506>
creator = 'pitrou'
dependencies = []
files = ['20077', '44066', '45258', '45617']
hgrepos = []
issue_num = 10721
keywords = ['patch']
message_count = 13.0
messages = ['124145', '124149', '124166', '124184', '221636', '221637', '261962', '261963', '272320', '272410', '272435', '279643', '281601']
nosy_count = 12.0
nosy_names = ['loewis', 'jhylton', 'barry', 'rhettinger', 'orsenthil', 'pitrou', 'giampaolo.rodola', 'stutzbach', 'eric.araujo', 'martin.panter', 'icordasc', 'Lukasa']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10721'
versions = ['Python 3.7']Linked PRs
- gh-54930: Send a status line in error responses to malformed request lines #152980
- [3.15] gh-54930: Send a status line in error responses to malformed request lines (GH-152980) #153092
- [3.14] gh-54930: Send a status line in error responses to malformed request lines (GH-152980) #153093
- [3.13] gh-54930: Send a status line in error responses to malformed request lines (GH-152980) #153094
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
pitrou commentedon Dec 16, 2010
http.server has support for old-style HTTP 0.9 requests ("command path" without a version string). This issue proposes to remove this support, since there are probably no clients around which still issue such requests.
See bpo-10711 for the client side.
merwok commentedon Dec 16, 2010
LGTM
loewis commentedon Dec 17, 2010
The question really is whether we want or want not to support RFC 1945 (i.e HTTP/1.0). If we want to support it, we also must comply to section 3.1, which says
The version of an HTTP message is indicated by an HTTP-Version field
in the first line of the message. If the protocol version is not
specified, the recipient must assume that the message is in the
simple HTTP/0.9 format.
If we then choose to not support HTTP/0.9 (after recognizing that the message is HTTP/0.9), we must then reject the request. According to RFC 2145, we then may send back error 505 (HTTP version not supported).
orsenthil commentedon Dec 17, 2010
If a client sends a request without specifying the version, GET /, then the Python server should behave like other common servers are behaving, namely support rfc 1945 for HTTP 1.0 spec and return the response without headers.
Removing the HTTP 0.9 from the http.client is okay. But punishing *any client* for not sending the correct request is not so desirable, especially when there are other servers which are lenient to his behavior for whatever reasons.
So, I am not a firm +1 to this. We should arrive a conclusion and then go about with the change. Martin's point is valid here too.
BreamoreBoy commentedon Jun 26, 2014
How, if at all, has the requirement for HTTP 0.9 support changed since this issue was first raised?
Lukasa commentedon Jun 26, 2014
To answer your question, Mark, RFC 7230 has removed the expectation that HTTP/1.1 servers will be able to support HTTP/0.9 requests.
vadmium commentedon Mar 18, 2016
Does this need any deprecation cycle, or can we just remove everything immediately in 3.6?
I suspect that the HTTP 0.9 support never properly worked, but I don’t have enough info to be sure. Wouldn’t a HTTP 0.9 request send b"GET <path>\r\n" with a single line, and then wait for a response? If so, Python’s server hangs waiting for a second blank line (or EOF), so the protocol will deadlock.
In any case, I would be in favour of removing HTTP 0.9 support. Senthil: do you know of actual clients that do HTTP 0.9 requests?
I left a review comment. The patch will also need manual merging with current code.
vadmium commentedon Mar 18, 2016
Also I guess documentation should be added somewhere, even if there is no deprecation step.
vadmium commentedon Aug 10, 2016
FWIW I doubt HTTP 1.1 ever required support for other HTTP versions; see for instance <https://tools.ietf.org/html/rfc2068#section-19.7\>.
This v2 patch adds another test that includes what I understand is a true HTTP 0.9 request (although the mock connection infrastructure closes the connection before receiving the response, so you don’t see any deadlock). This is based on <https://tools.ietf.org/html/rfc1945#page-22\>, which includes only one CRLF newline. I also added an entry to the What’s New page.
rhettinger commentedon Aug 11, 2016
There is so very little code in support of HTTP/0.9 that I don't think we get any benefit from removing it. So why bother with the churn? It is cleaner to just leave it place.
vadmium commentedon Aug 11, 2016
There are a few small benefits from removing it, but I am not too fussed if we decide to leave it.
If we keep it, should we fix it so that it doesn’t deadlock? Otherwise, we carry around buggy and untested code that claims to be a HTTP 0.9 server but isn’t. Keeping it as it is doesn’t feel “clean” to me.
Easy way to resolve bug reports like bpo-26578.
Potentially slightly easier to maintain the rest of the code in the future.
If we do keep it, I would like to add comments clarifying that it does not implement the real HTTP 0.9 protocol.
vadmium commentedon Oct 29, 2016
Here is a slightly updated patch I have been sitting on. I think the main difference was tweaks to the documentation.
bpo-28548 would also benefit if the HTTP 0.9 code was removed. The presence of the HTTP 0.9 code means a suboptimal response is sent in some error cases. IMO it would be better if the server responded using HTTP 1.0, where we can use error codes like “400 Bad request”. The current code will not use HTTP 1.0 unless it sees that the client supports it.
vadmium commentedon Nov 24, 2016
V4 patch adjusting to recent code change.
Raymond: Given the problems caused by the current code, would you reconsider your opposition?
Otherwise, what do you think should be the future of the code? Should we fix it so that it handles real HTTP 0.9 requests, or just admit that it doesn’t implement the protocol properly.
serhiy-storchaka commentedon Jul 3, 2026
The deadlock on HTTP/0.9 requests was fixed in gh-70765.
The remaining defect is that error responses to malformed request lines are sent in the bare HTTP/0.9 style, without a status line and headers. #152980 fixes this.
After that this issue can be closed, since HTTP/0.9 support now works and removing it was objected to.
gh-54930: Send a status line in error responses to malformed request …
[3.13] gh-54930: Send a status line in error responses to malformed r…
[3.14] gh-54930: Send a status line in error responses to malformed r…
[3.15] gh-54930: Send a status line in error responses to malformed r…