summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2019-04-13 00:07:04 -0500
committerMichael Merickel <michael@merickel.org>2019-04-13 00:07:04 -0500
commit57b20c45f88414d2a262b84d45673528030ed49d (patch)
treeb74ebb487fea0e930f9ac3f013e15d9fe659ff85
parenta2fae8642d2730e780504541e007a0334321e80c (diff)
downloadwaitress-crack-version.tar.gz
avoid converting the version to a string value "None", empty insteadcrack-version
-rw-r--r--waitress/parser.py2
-rw-r--r--waitress/tests/test_parser.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/waitress/parser.py b/waitress/parser.py
index 4106b56..e85ede2 100644
--- a/waitress/parser.py
+++ b/waitress/parser.py
@@ -293,7 +293,7 @@ def crack_first_line(line):
if m.group(3):
version = m.group(5)
else:
- version = None
+ version = b''
method = m.group(1)
# the request methods that are currently defined are all uppercase:
diff --git a/waitress/tests/test_parser.py b/waitress/tests/test_parser.py
index 801f784..cf4a976 100644
--- a/waitress/tests/test_parser.py
+++ b/waitress/tests/test_parser.py
@@ -309,9 +309,12 @@ class Test_crack_first_line(unittest.TestCase):
result = self._callFUT(b'GET / bleh')
self.assertEqual(result, (b'', b'', b''))
+ result = self._callFUT(b'GET /info?txtAirPlay&txtRAOP RTSP/1.0')
+ self.assertEqual(result, (b'', b'', b''))
+
def test_crack_first_line_missing_version(self):
result = self._callFUT(b'GET /')
- self.assertEqual(result, (b'GET', b'/', None))
+ self.assertEqual(result, (b'GET', b'/', b''))
class TestHTTPRequestParserIntegration(unittest.TestCase):