[Twisted-Python] twisted.web
Paul Boehm
typo at soniq.net
Fri Oct 4 10:16:23 MDT 2002
squished another bug:
adding a ? to any url ending with /, ended in a redirect to
//, on repetition to ///, and so on.
can anyone verify this doesn't break anything?
diff -u -r1.63 static.py
--- static.py 1 Oct 2002 17:28:46 -0000 1.63
+++ static.py 4 Oct 2002 16:15:32 -0000
@@ -59,10 +59,16 @@
return self.data
def addSlash(request):
- return "http%s://%s%s/" % (
+ #log.msg("request.uri: %s", request.uri)
+ host = request.getHeader("host")
+ path = string.split(request.uri,'?')[0]
+ slashfree_path = string.split(path,'/')[1]
+
+ return "http%s://%s/%s" % (
request.isSecure() and 's' or '',
- request.getHeader("host"),
- (string.split(request.uri,'?')[0]))
+ host,
+ slashfree_path
+ )
def redirectTo(URL, request):
request.redirect(URL)
More information about the Twisted-Python
mailing list