We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f1134a commit c3d4e6aCopy full SHA for c3d4e6a
examples/fragments/server_upgrade_fragment.py
@@ -45,14 +45,14 @@ def receive_initial_request(connection):
45
data += connection.recv(8192)
46
47
match = re.search(b'Upgrade: h2c\r\n', data)
48
- if match is not None:
+ if match is None:
49
raise RuntimeError("HTTP/2 upgrade not requested!")
50
51
# We need to look for the HTTP2-Settings header field. Again, in production
52
# code you shouldn't use regular expressions for this, but it's good enough
53
# for the example.
54
match = re.search(b'HTTP2-Settings: (\\S+)\r\n', data)
55
56
raise RuntimeError("HTTP2-Settings header field not present!")
57
58
return match.group(1)
0 commit comments