Skip to content

Commit c3d4e6a

Browse files
committed
Logic error fixed, closes #1106
1 parent 6f1134a commit c3d4e6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/fragments/server_upgrade_fragment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ def receive_initial_request(connection):
4545
data += connection.recv(8192)
4646

4747
match = re.search(b'Upgrade: h2c\r\n', data)
48-
if match is not None:
48+
if match is None:
4949
raise RuntimeError("HTTP/2 upgrade not requested!")
5050

5151
# We need to look for the HTTP2-Settings header field. Again, in production
5252
# code you shouldn't use regular expressions for this, but it's good enough
5353
# for the example.
5454
match = re.search(b'HTTP2-Settings: (\\S+)\r\n', data)
55-
if match is not None:
55+
if match is None:
5656
raise RuntimeError("HTTP2-Settings header field not present!")
5757

5858
return match.group(1)

0 commit comments

Comments
 (0)