New submission from Tom Forbes:

The builtin http.server module does not support HTTP keep-alive when sending a 
response without a content-length. This causes any clients to hang waiting on 
more response data, while the server hangs waiting for the client to send 
another request. This is documented 
(https://docs.python.org/3/library/http.server.html#http.server.BaseHTTPRequestHandler.protocol_version),
 but it is confusing.

As far as I can tell the fix would be pretty simple: If no content-length 
header is set then close the connection regardless of the keep-alive header 
(Keep-alive is advisory and servers can close the connection at-will, 
regardless of what the client sends).

If a response contains an inaccurate content-length header there is nothing we 
can do, but if none is present the server (and clients) should not just hang.

----------
components: Library (Lib)
messages: 299471
nosy: Tom Forbes
priority: normal
severity: normal
status: open
title: http.server should correctly handle HTTP 1.1 responses without a 
content-length
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31076>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to