[New-bugs-announce] [issue46285] http/server.py wont respect its protocol_version
report at bugs.python.org
Thu Jan 6 13:39:21 EST 2022
New submission from Hugo Almeida <sudo.xiangqian at gmail.com>:
Sorry for my poor English, this is not a spam issue.
How to reproduce
File about `http/server.py`, line 1235 at main branch.
1st, change `protocol_version`, e.g. from "HTTP/1.0" to "HTTP/1.1":
--- protocol="HTTP/1.0", port=8000, ...
+++ protocol="HTTP/1.1", port=8000, ...
2ed, run with `python -m http.server` and test by: `curl http://127.0.0.1:8000 2>/dev/null| head -n 1`
The response head line will always been a fixed HTTP Version refer to `BaseHTTPRequestHandler.protocol_version` defined, thus "HTTP/1.0 200 OK" currently.
It should equal to `http.server.test(protocol="...")` which specified like above, for this issue, it is expected to be "HTTP/1.1 200 OK".
I know it is just locate in a test code area (http.servers::test), but what I submit here is about a Python Variable Scope issue maybe.
components: Library (Lib)
title: http/server.py wont respect its protocol_version
versions: Python 3.11
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce