Message158158
I notice a deficiency in is_cgi: there is no documentation requiring cgi_directories to be a single part, only that the initial value happens to be a list of two directories, each of which have only a single part or level. The description of is_cgi, however, only requires that the strings in self.cgi_directories be prefixes of self.path, followed by "/" or end of string. While it is not at all clear that being followed by end of string would produce useful results, the description does allow for multiple parts in the directory, but the implementation does not.
Consider a potential value in an overridden or augmented cgi_directories such as '/subdomain/cgi-bin'. The current is_cgi wouldn't handle that.
Solution: replace the following is_cgi code (from current trunk):
collapsed_path = _url_collapse_path(self.path)
dir_sep = collapsed_path.find('/', 1)
head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
if head in self.cgi_directories:
self.cgi_info = head, tail
return True
return False
with:
cln = len( collapsed_path )
found = False
for ix in self.cgi_directories:
ln = len( ix )
print('is_cgi: %d %d - %s - %s'
% ( ln, cln, ix, collapsed_path ))
if ln == cln and ix == collapsed_path:
self.cgi_info = ( ix, '')
found = True
break
elif ( ln < cln and collapsed_path[ ln ] == '/'
and collapsed_path.startswith( ix )):
self.cgi_info = ( ix, collapsed_path[ ln+1: ])
found = True
break
return found |
|
Date |
User |
Action |
Args |
2012-04-12 18:21:06 | v+python | set | recipients:
+ v+python |
2012-04-12 18:21:06 | v+python | set | messageid: <1334254866.64.0.659489278184.issue14565@psf.upfronthosting.co.za> |
2012-04-12 18:21:06 | v+python | link | issue14565 messages |
2012-04-12 18:21:05 | v+python | create | |
|