Skip to content

Commit

Permalink
Remove root_path from logs (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee authored Dec 25, 2021
1 parent 65ec8d1 commit 66e22f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions uvicorn/protocols/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ def get_client_addr(scope: WWWScope) -> str:


def get_path_with_query_string(scope: WWWScope) -> str:
path_with_query_string = urllib.parse.quote(
scope.get("root_path", "") + scope["path"]
)
path_with_query_string = urllib.parse.quote(scope["path"])
if scope["query_string"]:
path_with_query_string = "{}?{}".format(
path_with_query_string, scope["query_string"].decode("ascii")
Expand Down
4 changes: 2 additions & 2 deletions uvicorn/protocols/websockets/websockets_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ async def asgi_send(self, message):
self.logger.info(
'%s - "WebSocket %s" [accepted]',
self.scope["client"],
self.scope["root_path"] + self.scope["path"],
self.scope["path"],
)
self.initial_response = None
self.accepted_subprotocol = message.get("subprotocol")
Expand All @@ -237,7 +237,7 @@ async def asgi_send(self, message):
self.logger.info(
'%s - "WebSocket %s" 403',
self.scope["client"],
self.scope["root_path"] + self.scope["path"],
self.scope["path"],
)
self.initial_response = (http.HTTPStatus.FORBIDDEN, [], b"")
self.handshake_started_event.set()
Expand Down
4 changes: 2 additions & 2 deletions uvicorn/protocols/websockets/wsproto_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ async def send(self, message):
self.logger.info(
'%s - "WebSocket %s" [accepted]',
self.scope["client"],
self.scope["root_path"] + self.scope["path"],
self.scope["path"],
)
self.handshake_complete = True
subprotocol = message.get("subprotocol")
Expand All @@ -269,7 +269,7 @@ async def send(self, message):
self.logger.info(
'%s - "WebSocket %s" 403',
self.scope["client"],
self.scope["root_path"] + self.scope["path"],
self.scope["path"],
)
self.handshake_complete = True
self.close_sent = True
Expand Down

0 comments on commit 66e22f8

Please sign in to comment.