Hello,
I found what I think may be a bug in URLParser.py. When a request for a
directory is missing a trailing slash, a redirect is generated with the
trailing slash. The problem is that the query string is left out of the
redirect url and gets lost.
I noticed this problem when updating a webware site to webware 0.9
recently. Looking at the source code I found the problem.
From URLParser.py in class _FileParser in method parseIndex (line 493):
# If requestPath is empty, then we're missing the trailing slash:
if not requestPath:
raise HTTPMovedPermanently(
webkitLocation=trans.request().urlPath() + "/")
I modified the code snippet above to read as follows and it seems to work:
# If requestPath is empty, then we're missing the trailing slash:
if not requestPath:
qs = trans.request().queryString()
if qs:
qs = "?" + qs
raise HTTPMovedPermanently(
webkitLocation=trans.request().urlPath() + "/" + qs)
Am I on the right track here? Is this a bug or am I missing something?
Thanks for your attention,
- Sam
|