Handle non-ASCII characters gracefully in old cgi-bin script redirects

- Legacy-Id: 1988
This commit is contained in:
Pasi Eronen 2010-02-17 12:43:04 +00:00
parent 294f812646
commit 83ba4181ca
2 changed files with 8 additions and 1 deletions

View file

@ -6,6 +6,9 @@
404 /_doesnotexist/
#skip /_test500/
# non-ASCII parameter
301 /public/pidtracker.cgi?command=view_id&dTag=11171%D182&rfc_flag=0
#301 /list/request.... # test middleware that strips periods and redirects instead of 404
#skip /images/ietf-icon.bmp
#skip /css/base.css

View file

@ -54,7 +54,11 @@ def redirect(request, path="", script=""):
else:
remove = ""
try:
url += rest % request.REQUEST
# This throws exception (which gets caught below) if request
# contains non-ASCII characters. The old scripts didn't support
# non-ASCII characters anyway, so there's no need to handle
# them fully correctly in these redirects.
url += str(rest % request.REQUEST)
url += "/"
except:
# rest had something in it that request didn't have, so just