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

Turn raw_path into bytes on both websockets implementations #1487

Merged
merged 2 commits into from May 16, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/protocols/test_websocket.py
Expand Up @@ -220,7 +220,7 @@ async def websocket_connect(self, message):
path = self.scope.get("path")
raw_path = self.scope.get("raw_path")
assert path == "/one/two"
assert raw_path == "/one%2Ftwo"
assert raw_path == b"/one%2Ftwo"
await self.send({"type": "websocket.accept"})

async def open_connection(url):
Expand Down
2 changes: 1 addition & 1 deletion uvicorn/protocols/websockets/websockets_impl.py
Expand Up @@ -133,7 +133,7 @@ async def process_request(self, path, headers):
"client": self.client,
"root_path": self.root_path,
"path": unquote(path_portion),
"raw_path": path_portion,
"raw_path": path_portion.encode("ascii"),
"query_string": query_string.encode("ascii"),
"headers": asgi_headers,
"subprotocols": subprotocols,
Expand Down
2 changes: 1 addition & 1 deletion uvicorn/protocols/websockets/wsproto_impl.py
Expand Up @@ -144,7 +144,7 @@ def handle_connect(self, event):
"client": self.client,
"root_path": self.root_path,
"path": unquote(raw_path),
"raw_path": raw_path,
"raw_path": raw_path.encode("ascii"),
"query_string": query_string.encode("ascii"),
"headers": headers,
"subprotocols": event.subprotocols,
Expand Down