File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -850,14 +850,7 @@ def _url_collapse_path_split(path):
850850 # Filter out blank non trailing parts before consuming the '..'.
851851 path_parts = [part for part in path_parts [:- 1 ] if part ] + path_parts [- 1 :]
852852 if path_parts :
853- # Special case for CGI's for PATH_INFO
854- if path .startswith ('/cgi-bin' ) or path .startswith ('/htbin' ):
855- tail_part = []
856- while path_parts [- 1 ] not in ('cgi-bin' ,'htbin' ):
857- tail_part .insert (0 ,path_parts .pop ())
858- tail_part = "/" .join (tail_part )
859- else :
860- tail_part = path_parts .pop ()
853+ tail_part = path_parts .pop ()
861854 else :
862855 tail_part = ''
863856 head_parts = []
@@ -952,8 +945,11 @@ def is_cgi(self):
952945 """
953946
954947 splitpath = _url_collapse_path_split (self .path )
955- if splitpath [0 ] in self .cgi_directories :
956- self .cgi_info = splitpath
948+ joined_path = '/' .join (splitpath )
949+ dir_sep = joined_path .find ('/' ,1 )
950+ head , tail = joined_path [:dir_sep ], joined_path [dir_sep + 1 :]
951+ if head in self .cgi_directories :
952+ self .cgi_info = head , tail
957953 return True
958954 return False
959955
Original file line number Diff line number Diff line change @@ -377,7 +377,6 @@ def test_url_collapse_path_split(self):
377377 '/.//' : ('/' , '' ),
378378 'cgi-bin/file1.py' : ('/cgi-bin' , 'file1.py' ),
379379 '/cgi-bin/file1.py' : ('/cgi-bin' , 'file1.py' ),
380- '/cgi-bin/file1.py/PATH-INFO' : ('/cgi-bin' , 'file1.py/PATH-INFO' ),
381380 'a' : ('/' , 'a' ),
382381 '/a' : ('/' , 'a' ),
383382 '//a' : ('/' , 'a' ),
You can’t perform that action at this time.
0 commit comments