Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update llhttp to version 6.0.9 #83

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
[submodule "vendor/llhttp"]
path = vendor/llhttp
url = https://github.com/nodejs/llhttp.git
branch = release
44 changes: 22 additions & 22 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Accept-Ranges: bytes
Connection: close
'''
'''.replace(b'\n', b'\r\n')

RESPONSE1_BODY = b'''
<html>
Expand All @@ -29,31 +29,31 @@
</html>'''


CHUNKED_REQUEST1_1 = b'''POST /test.php?a=b+c HTTP/1.2
User-Agent: Fooo
Host: bar
Transfer-Encoding: chunked
CHUNKED_REQUEST1_1 = b'''POST /test.php?a=b+c HTTP/1.1\r
User-Agent: Fooo\r
Host: bar\r
Transfer-Encoding: chunked\r
5\r\nhello\r\n6\r\n world\r\n'''

CHUNKED_REQUEST1_2 = b'''0\r\nVary: *\r\nUser-Agent: spam\r\n\r\n'''

CHUNKED_REQUEST1_3 = b'''POST /test.php?a=b+c HTTP/1.2
User-Agent: Fooo
Host: bar
Transfer-Encoding: chunked
CHUNKED_REQUEST1_3 = b'''POST /test.php?a=b+c HTTP/1.1\r
User-Agent: Fooo\r
Host: bar\r
Transfer-Encoding: chunked\r
b\r\n+\xce\xcfM\xb5MI,I\x04\x00\r\n0\r\n\r\n'''


UPGRADE_REQUEST1 = b'''GET /demo HTTP/1.1
Host: example.com
Connection: Upgrade
Sec-WebSocket-Key2: 12998 5 Y3 1 .P00
Sec-WebSocket-Protocol: sample
Upgrade: WebSocket
Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5
Origin: http://example.com
UPGRADE_REQUEST1 = b'''GET /demo HTTP/1.1\r
Host: example.com\r
Connection: Upgrade\r
Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r
Sec-WebSocket-Protocol: sample\r
Upgrade: WebSocket\r
Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r
Origin: http://example.com\r
Hot diggity dogg'''

Expand Down Expand Up @@ -233,7 +233,7 @@ def test_parser_request_chunked_1(self):
m.on_message_begin.assert_called_once_with()

m.on_url.assert_called_once_with(b'/test.php?a=b+c')
self.assertEqual(p.get_http_version(), '1.2')
self.assertEqual(p.get_http_version(), '1.1')

m.on_header.assert_called_with(b'Transfer-Encoding', b'chunked')
m.on_chunk_header.assert_called_with()
Expand Down Expand Up @@ -316,7 +316,7 @@ def test_parser_request_chunked_3(self):
self.assertEqual(p.get_method(), b'POST')

m.on_url.assert_called_once_with(b'/test.php?a=b+c')
self.assertEqual(p.get_http_version(), '1.2')
self.assertEqual(p.get_http_version(), '1.1')

m.on_header.assert_called_with(b'Transfer-Encoding', b'chunked')
m.on_chunk_header.assert_called_with()
Expand Down Expand Up @@ -439,17 +439,17 @@ class Error(Exception):
def test_parser_request_2(self):
p = httptools.HttpRequestParser(None)
with self.assertRaises(httptools.HttpParserInvalidMethodError):
p.feed_data(b'SPAM /test.php?a=b+c HTTP/1.2')
p.feed_data(b'SPAM /test.php?a=b+c HTTP/1.1')

def test_parser_request_3(self):
p = httptools.HttpRequestParser(None)
with self.assertRaises(httptools.HttpParserInvalidURLError):
p.feed_data(b'POST HTTP/1.2')
p.feed_data(b'POST HTTP/1.1')

def test_parser_request_4(self):
p = httptools.HttpRequestParser(None)
with self.assertRaisesRegex(TypeError, 'a bytes-like object'):
p.feed_data('POST HTTP/1.2')
p.feed_data('POST HTTP/1.1')

def test_parser_request_fragmented(self):
m = mock.Mock()
Expand Down
2 changes: 1 addition & 1 deletion vendor/llhttp
Submodule llhttp updated 7 files
+89 −27 CMakeLists.txt
+34 −2 README.md
+19 −6 include/llhttp.h
+10 −0 libllhttp.pc.in
+8 −0 src/api.c
+2 −1 src/http.c
+1,173 −411 src/llhttp.c