File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
import http
2
2
import logging
3
3
import sys
4
+ import urllib
4
5
from copy import copy
5
6
6
7
import click
@@ -77,14 +78,14 @@ def get_client_addr(self, scope):
77
78
return "%s:%d" % (client [0 ], client [1 ])
78
79
79
80
def get_path (self , scope ):
80
- return scope .get ("root_path" , "" ) + scope ["path" ]
81
+ return urllib . parse . quote ( scope .get ("root_path" , "" ) + scope ["path" ])
81
82
82
83
def get_full_path (self , scope ):
83
84
path = scope .get ("root_path" , "" ) + scope ["path" ]
84
85
query_string = scope .get ("query_string" , b"" ).decode ("ascii" )
85
86
if query_string :
86
- return path + "?" + query_string
87
- return path
87
+ return urllib . parse . quote ( path ) + "?" + query_string
88
+ return urllib . parse . quote ( path )
88
89
89
90
def get_status_code (self , record ):
90
91
status_code = record .__dict__ ["status_code" ]
Original file line number Diff line number Diff line change 1
1
import socket
2
+ import urllib
2
3
3
4
4
5
def get_remote_addr (transport ):
@@ -49,7 +50,9 @@ def get_client_addr(scope):
49
50
50
51
51
52
def get_path_with_query_string (scope ):
52
- path_with_query_string = scope .get ("root_path" , "" ) + scope ["path" ]
53
+ path_with_query_string = urllib .parse .quote (
54
+ scope .get ("root_path" , "" ) + scope ["path" ]
55
+ )
53
56
if scope ["query_string" ]:
54
57
path_with_query_string = "{}?{}" .format (
55
58
path_with_query_string , scope ["query_string" ].decode ("ascii" )
You can’t perform that action at this time.
0 commit comments