[Twisted-Python] Broken Twisted on Debian/sarge

Andrew Bennetts andrew-twisted at puzzling.org
Thu Jun 26 18:28:58 MDT 2003


On Thu, Jun 26, 2003 at 02:58:32PM -0500, Glyph Lefkowitz wrote:
> 
> On Thursday, June 26, 2003, at 11:45 AM, Alex Levy wrote:
> 
> >it endlessly redirects, with my log files piling up with requests for 
> >http://mysite/////////////////////
> 
> !@#!@%$~!
> 
> I thought this was just spiv's bug, but I just had a look in 
> twisted.web.static.File.  When did it get this bad?  Is this my fault? 
> :-)  getChild() and render() are both _disasters_, which look like 
> they've been hacked on by in excess of 10 people who didn't really 
> understand what they're doing.  I can't immediately unravel it enough 
> to get a bugfix in, and there are no tests.

Actually, I think this is *still* my bug.  Tests would *really* help here ;)

I suspect this patch will fix it:

Index: twisted/web/static.py
===================================================================
RCS file: /cvs/Twisted/twisted/web/static.py,v
retrieving revision 1.95
diff -u -r1.95 static.py
--- twisted/web/static.py       22 Jun 2003 01:01:57 -0000      1.95
+++ twisted/web/static.py       27 Jun 2003 00:26:38 -0000
@@ -288,7 +288,7 @@
         if path == '..':
             return error.NoResource("Invalid request URL.")
 
-        if path == '':
+        if path == '' and os.path.isfile(self.path):
             childPath = self.path
         else:
             childPath = os.path.join(self.path, path)

But I don't have time to test right at the moment.

On the weekend, if no-one else gets to it first, I'll probably have a look
at writing tests, and cleaning up static.File.  It does look rather messy.

-Andrew.





More information about the Twisted-Python mailing list