diff options
author | Allan Saddi <allan@saddi.com> | 2008-07-22 09:53:30 -0700 |
---|---|---|
committer | Allan Saddi <allan@saddi.com> | 2008-07-22 09:53:30 -0700 |
commit | 206878f9439d93e0ae08162df28b85bc9a54a369 (patch) | |
tree | a1101f4365387ef7409c18917bd709cb5e0f3500 /flup/server/fcgi_base.py | |
parent | 80ef6eecad7b42dffdb38fa510d71ebe3a012581 (diff) | |
download | flup-206878f9439d93e0ae08162df28b85bc9a54a369.tar.gz |
Revise previous patch for compatibility with pre-2.5 Python.
Diffstat (limited to 'flup/server/fcgi_base.py')
-rw-r--r-- | flup/server/fcgi_base.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/flup/server/fcgi_base.py b/flup/server/fcgi_base.py index 34c0fbd..e012c94 100644 --- a/flup/server/fcgi_base.py +++ b/flup/server/fcgi_base.py @@ -1136,14 +1136,19 @@ class BaseFCGIServer(object): """Ensure certain values are present, if required by WSGI.""" if not environ.has_key('SCRIPT_NAME'): environ['SCRIPT_NAME'] = '' + + reqUri = None + if environ.has_key('REQUEST_URI'): + reqUri = environ['REQUEST_URI'].split('?', 1) + if not environ.has_key('PATH_INFO') or not environ['PATH_INFO']: - if environ.has_key('REQUEST_URI'): - environ['PATH_INFO'] = environ['REQUEST_URI'].partition('?')[0] + if reqUri is not None: + environ['PATH_INFO'] = reqUri[0] else: environ['PATH_INFO'] = '' if not environ.has_key('QUERY_STRING') or not environ['QUERY_STRING']: - if environ.has_key('REQUEST_URI'): - environ['QUERY_STRING'] = environ['REQUEST_URI'].partition('?')[2] + if reqUri is not None and len(reqUri) > 1: + environ['QUERY_STRING'] = reqUri[1] else: environ['QUERY_STRING'] = '' |