|
16 | 16 | Accept-Ranges: bytes |
17 | 17 | Connection: close |
18 | 18 |
|
19 | | -''' |
| 19 | +'''.replace(b'\n', b'\r\n') |
20 | 20 |
|
21 | 21 | RESPONSE1_BODY = b''' |
22 | 22 | <html> |
|
29 | 29 | </html>''' |
30 | 30 |
|
31 | 31 |
|
32 | | -CHUNKED_REQUEST1_1 = b'''POST /test.php?a=b+c HTTP/1.2 |
33 | | -User-Agent: Fooo |
34 | | -Host: bar |
35 | | -Transfer-Encoding: chunked |
| 32 | +CHUNKED_REQUEST1_1 = b'''POST /test.php?a=b+c HTTP/1.1\r |
| 33 | +User-Agent: Fooo\r |
| 34 | +Host: bar\r |
| 35 | +Transfer-Encoding: chunked\r |
36 | 36 |
|
37 | 37 | 5\r\nhello\r\n6\r\n world\r\n''' |
38 | 38 |
|
39 | 39 | CHUNKED_REQUEST1_2 = b'''0\r\nVary: *\r\nUser-Agent: spam\r\n\r\n''' |
40 | 40 |
|
41 | | -CHUNKED_REQUEST1_3 = b'''POST /test.php?a=b+c HTTP/1.2 |
42 | | -User-Agent: Fooo |
43 | | -Host: bar |
44 | | -Transfer-Encoding: chunked |
| 41 | +CHUNKED_REQUEST1_3 = b'''POST /test.php?a=b+c HTTP/1.1\r |
| 42 | +User-Agent: Fooo\r |
| 43 | +Host: bar\r |
| 44 | +Transfer-Encoding: chunked\r |
45 | 45 |
|
46 | 46 | b\r\n+\xce\xcfM\xb5MI,I\x04\x00\r\n0\r\n\r\n''' |
47 | 47 |
|
48 | 48 |
|
49 | | -UPGRADE_REQUEST1 = b'''GET /demo HTTP/1.1 |
50 | | -Host: example.com |
51 | | -Connection: Upgrade |
52 | | -Sec-WebSocket-Key2: 12998 5 Y3 1 .P00 |
53 | | -Sec-WebSocket-Protocol: sample |
54 | | -Upgrade: WebSocket |
55 | | -Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5 |
56 | | -Origin: http://example.com |
| 49 | +UPGRADE_REQUEST1 = b'''GET /demo HTTP/1.1\r |
| 50 | +Host: example.com\r |
| 51 | +Connection: Upgrade\r |
| 52 | +Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r |
| 53 | +Sec-WebSocket-Protocol: sample\r |
| 54 | +Upgrade: WebSocket\r |
| 55 | +Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r |
| 56 | +Origin: http://example.com\r |
57 | 57 |
|
58 | 58 | Hot diggity dogg''' |
59 | 59 |
|
@@ -233,7 +233,7 @@ def test_parser_request_chunked_1(self): |
233 | 233 | m.on_message_begin.assert_called_once_with() |
234 | 234 |
|
235 | 235 | m.on_url.assert_called_once_with(b'/test.php?a=b+c') |
236 | | - self.assertEqual(p.get_http_version(), '1.2') |
| 236 | + self.assertEqual(p.get_http_version(), '1.1') |
237 | 237 |
|
238 | 238 | m.on_header.assert_called_with(b'Transfer-Encoding', b'chunked') |
239 | 239 | m.on_chunk_header.assert_called_with() |
@@ -316,7 +316,7 @@ def test_parser_request_chunked_3(self): |
316 | 316 | self.assertEqual(p.get_method(), b'POST') |
317 | 317 |
|
318 | 318 | m.on_url.assert_called_once_with(b'/test.php?a=b+c') |
319 | | - self.assertEqual(p.get_http_version(), '1.2') |
| 319 | + self.assertEqual(p.get_http_version(), '1.1') |
320 | 320 |
|
321 | 321 | m.on_header.assert_called_with(b'Transfer-Encoding', b'chunked') |
322 | 322 | m.on_chunk_header.assert_called_with() |
@@ -439,17 +439,17 @@ class Error(Exception): |
439 | 439 | def test_parser_request_2(self): |
440 | 440 | p = httptools.HttpRequestParser(None) |
441 | 441 | with self.assertRaises(httptools.HttpParserInvalidMethodError): |
442 | | - p.feed_data(b'SPAM /test.php?a=b+c HTTP/1.2') |
| 442 | + p.feed_data(b'SPAM /test.php?a=b+c HTTP/1.1') |
443 | 443 |
|
444 | 444 | def test_parser_request_3(self): |
445 | 445 | p = httptools.HttpRequestParser(None) |
446 | 446 | with self.assertRaises(httptools.HttpParserInvalidURLError): |
447 | | - p.feed_data(b'POST HTTP/1.2') |
| 447 | + p.feed_data(b'POST HTTP/1.1') |
448 | 448 |
|
449 | 449 | def test_parser_request_4(self): |
450 | 450 | p = httptools.HttpRequestParser(None) |
451 | 451 | with self.assertRaisesRegex(TypeError, 'a bytes-like object'): |
452 | | - p.feed_data('POST HTTP/1.2') |
| 452 | + p.feed_data('POST HTTP/1.1') |
453 | 453 |
|
454 | 454 | def test_parser_request_fragmented(self): |
455 | 455 | m = mock.Mock() |
|
0 commit comments