avoid recursion in rewrite, thanks Jonathan
This commit is contained in:
1 parent
08f813d670
commit
1509559e78
2 files changed
+10
-16
No files matched your search
@@ -1 +1 @@
|
|||||||
Version 2.5.1-stable+timestamp.2013.06.20.16.43.32
|
Version 2.5.1-stable+timestamp.2013.06.21.01.46.48
|
||||||
+9
-15
@@ -244,21 +244,15 @@ def try_rewrite_on_error(http_response, request, environ, ticket=None):
|
|||||||
url = path_info + '?' + query_string
|
url = path_info + '?' + query_string
|
||||||
message = 'You are being redirected <a href="%s">here</a>'
|
message = 'You are being redirected <a href="%s">here</a>'
|
||||||
return HTTP(303, message % url, Location=url), environ
|
return HTTP(303, message % url, Location=url), environ
|
||||||
else:
|
elif not environ.get('__ROUTES_ONERROR__', False):
|
||||||
error_raising_path = environ['PATH_INFO']
|
# wsgibase will be called recursively with
|
||||||
# Rewrite routes_onerror path.
|
# the routes_onerror path.
|
||||||
path_info = '/' + path_info.lstrip(
|
environ['__ROUTES_ONERROR__'] = True # limit recursion
|
||||||
'/') # add leading '/' if missing
|
path_info = '/' + path_info.lstrip('/')
|
||||||
environ['PATH_INFO'] = path_info
|
environ['PATH_INFO'] = path_info
|
||||||
error_handling_path = \
|
environ['QUERY_STRING'] = query_string
|
||||||
url_in(request, environ)[2]['PATH_INFO']
|
environ['WEB2PY_STATUS_CODE'] = status
|
||||||
# Avoid infinite loop.
|
return None, environ
|
||||||
if error_handling_path != error_raising_path:
|
|
||||||
# wsgibase will be called recursively with the routes_onerror path.
|
|
||||||
environ['PATH_INFO'] = path_info
|
|
||||||
environ['QUERY_STRING'] = query_string
|
|
||||||
environ['WEB2PY_STATUS_CODE'] = status
|
|
||||||
return None, environ
|
|
||||||
# do nothing!
|
# do nothing!
|
||||||
return http_response, environ
|
return http_response, environ
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user