Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14199f9

Browse files
committed
#20155: use fake HTTP method names so windows doesn't hang the tests.
Windows was seeing the 'GET' generated by these tests as invalid and forcibly closing the socket, causing the test to fail. Patch by Jeff Allen.
1 parent a02f81f commit 14199f9

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/test/test_httpservers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_command(self):
125125

126126
def test_request_line_trimming(self):
127127
self.con._http_vsn_str = 'HTTP/1.1\n'
128-
self.con.putrequest('GET', '/')
128+
self.con.putrequest('XYZBOGUS', '/')
129129
self.con.endheaders()
130130
res = self.con.getresponse()
131131
self.assertEqual(res.status, 501)
@@ -152,8 +152,9 @@ def test_version_none_get(self):
152152
self.assertEqual(res.status, 501)
153153

154154
def test_version_none(self):
155+
# Test that a valid method is rejected when not HTTP/1.x
155156
self.con._http_vsn_str = ''
156-
self.con.putrequest('PUT', '/')
157+
self.con.putrequest('CUSTOM', '/')
157158
self.con.endheaders()
158159
res = self.con.getresponse()
159160
self.assertEqual(res.status, 400)

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Yaniv Aknin
2929
Jyrki Alakuijala
3030
Steve Alexander
3131
Fred Allen
32+
Jeff Allen
3233
Ray Allen
3334
Billy G. Allie
3435
Kevin Altis

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ IDLE
133133
Tests
134134
-----
135135

136+
- Issue #20155: Changed HTTP method names in failing tests in test_httpservers
137+
so that packet filtering software (specifically Windows Base Filtering Engine)
138+
does not interfere with the transaction semantics expected by the tests.
139+
136140
- Issue #19493: Refactored the ctypes test package to skip tests explicitly
137141
rather than silently.
138142

0 commit comments

Comments
 (0)