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

avoid converting the version to a string value "None", empty instead #252

Merged
merged 1 commit into from
Apr 13, 2019
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
2 changes: 1 addition & 1 deletion waitress/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion waitress/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,12 @@ def test_crack_first_line_nomatch(self):
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):

Expand Down