diff --git a/httpout/__init__.py b/httpout/__init__.py index 031f050..46cdc72 100644 --- a/httpout/__init__.py +++ b/httpout/__init__.py @@ -1,6 +1,6 @@ # Copyright (c) 2024 nggit -__version__ = '0.0.68' +__version__ = '0.0.69' __all__ = ('HTTPOut',) from .httpout import HTTPOut # noqa: E402 diff --git a/httpout/utils/modules.pyx b/httpout/utils/modules.pyx index 2a6a57f..ebd1ea4 100644 --- a/httpout/utils/modules.pyx +++ b/httpout/utils/modules.pyx @@ -42,7 +42,7 @@ def exec_module(module, code=None, size_t max_size=8 * 1048576): fclose(fp) - code = compile(data.decode('utf-8'), '', 'exec') + code = compile(data, '', 'exec') exec(code, module.__dict__) return code diff --git a/tests/test_http.py b/tests/test_http.py index 88dffbd..d5b5188 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -52,7 +52,8 @@ def test_imports(self): version='1.1') self.assertEqual( - header[:header.find(b'\r\n')], b'HTTP/1.1 201 Created' + header[:header.find(b'\r\n')], + b'HTTP/1.1 201 Created' ) self.assertTrue(b'\r\nFoo: baz' in header) self.assertTrue(b'\r\nSet-Cookie: foo=bar; ' in header) @@ -193,7 +194,8 @@ def test_badrequest(self): ) self.assertEqual( - header[:header.find(b'\r\n')], b'HTTP/1.1 400 Bad Request' + header[:header.find(b'\r\n')], + b'HTTP/1.1 400 Bad Request' ) def test_private_file(self): @@ -268,9 +270,10 @@ def test_sec_unsafe_chars_nul(self): version='1.1') # NUL is already handled by upstream - # currently the response is empty - self.assertEqual(header, b'') - self.assertEqual(body, b'') + self.assertEqual( + header[:header.find(b'\r\n')], + b'HTTP/1.0 400 Bad Request' + ) def test_disallowed_ext(self): header, body = getcontents(host=HTTP_HOST,