[New-bugs-announce] [issue46285] http/server.py wont respect its protocol_version

Hugo Almeida report at bugs.python.org
Thu Jan 6 13:39:21 EST 2022


New submission from Hugo Almeida <sudo.xiangqian at gmail.com>:

Hi,

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`

Result
======

The response head line will always been a fixed HTTP Version refer to `BaseHTTPRequestHandler.protocol_version` defined, thus "HTTP/1.0 200 OK" currently.

Expected
========

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".

P.S.
====

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)
messages: 409894
nosy: openalmeida
priority: normal
severity: normal
status: open
title: http/server.py wont respect its protocol_version
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46285>
_______________________________________


More information about the New-bugs-announce mailing list