Allow case-insensitive HTTP Upgrade header (#2097)
* Allow case-insensitive HTTP Upgrade header * Allow case-insensitive Upgrade header when checking the scheme * Fix reference to headers * Add None check * Simplify HTTP Upgrade checks * Fix newlines at end of file * Run make pretty
This commit is contained in:
parent
93a0246c03
commit
eba7821a6d
|
@ -218,7 +218,9 @@ class Http:
|
|||
raise InvalidUsage("Bad Request")
|
||||
|
||||
headers_instance = Header(headers)
|
||||
self.upgrade_websocket = headers_instance.get("upgrade") == "websocket"
|
||||
self.upgrade_websocket = (
|
||||
headers_instance.get("upgrade", "").lower() == "websocket"
|
||||
)
|
||||
|
||||
# Prepare a Request object
|
||||
request = self.protocol.request_class(
|
||||
|
|
|
@ -581,7 +581,7 @@ class Request:
|
|||
|
||||
if (
|
||||
self.app.websocket_enabled
|
||||
and self.headers.get("upgrade") == "websocket"
|
||||
and self.headers.get("upgrade", "").lower() == "websocket"
|
||||
):
|
||||
scheme = "ws"
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user