File tree 2 files changed +12
-2
lines changed 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -25,17 +25,27 @@ class HelloHandler(RequestHandler):
25
25
def get (self ):
26
26
self .write ("Hello world!" )
27
27
28
+ class PathQuotingHandler (RequestHandler ):
29
+ def get (self , path ):
30
+ self .write (path )
31
+
28
32
# It would be better to run the wsgiref server implementation in
29
33
# another thread instead of using our own WSGIContainer, but this
30
34
# fits better in our async testing framework and the wsgiref
31
35
# validator should keep us honest
32
36
return WSGIContainer (validator (WSGIApplication ([
33
- ("/" , HelloHandler )])))
37
+ ("/" , HelloHandler ),
38
+ ("/path/(.*)" , PathQuotingHandler ),
39
+ ])))
34
40
35
41
def test_simple (self ):
36
42
response = self .fetch ("/" )
37
43
self .assertEqual (response .body , b ("Hello world!" ))
38
44
45
+ def test_path_quoting (self ):
46
+ response = self .fetch ("/path/foo%20bar%C3%A9" )
47
+ self .assertEqual (response .body , u"foo bar\u00e9 " .encode ("utf-8" ))
48
+
39
49
# This is kind of hacky, but run some of the HTTPServer tests through
40
50
# WSGIContainer and WSGIApplication to make sure everything survives
41
51
# repeated disassembly and reassembly.
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ def environ(request):
235
235
environ = {
236
236
"REQUEST_METHOD" : request .method ,
237
237
"SCRIPT_NAME" : "" ,
238
- "PATH_INFO" : request .path ,
238
+ "PATH_INFO" : urllib . unquote ( request .path ) ,
239
239
"QUERY_STRING" : request .query ,
240
240
"REMOTE_ADDR" : request .remote_ip ,
241
241
"SERVER_NAME" : host ,
You can’t perform that action at this time.
0 commit comments