homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author v+python
Recipients v+python
Date 2012年04月12日.18:21:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1334254866.64.0.659489278184.issue14565@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2012年04月12日 18:21:06v+pythonsetrecipients: + v+python
2012年04月12日 18:21:06v+pythonsetmessageid: <1334254866.64.0.659489278184.issue14565@psf.upfronthosting.co.za>
2012年04月12日 18:21:06v+pythonlinkissue14565 messages
2012年04月12日 18:21:05v+pythoncreate

AltStyle によって変換されたページ (->オリジナル) /