8000 BPO-25095: test_httpservers hangs since Python 3.5 · python/cpython@6701a44 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6701a44

Browse files
committed
BPO-25095: test_httpservers hangs since Python 3.5
1 parent 604e7b9 commit 6701a44

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_httpservers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,13 @@ def test_get(self):
305305
self.con.connect()
306306

307307
with support.captured_stderr() as err:
308-
self.con.request('GET', '/')
308+
# bpo-25095: HTTP/1.1 specifies that the socket connection is to
309+
# remain open, this, on certain systems, causes Python to deadlock
310+
# waiting for the socket to close.
311+
# To combat this, we send the test server the "Connection" header
312+
# with "close" for the value forcing the server and client to
313+
# terminate the socket allowing the test to resume.
314+
self.con.request('GET', '/', headers={'Content-Length': '0', 'Connection': 'close'})
309315
self.con.getresponse()
310316

311317
self.assertTrue(

0 commit comments

Comments
 (0)
0