Return 404s to all requests for Packages.diff and Sources.diff.
authorCameron Dale <camrdale@gmail.com>
Mon, 31 Mar 2008 23:03:05 +0000 (16:03 -0700)
committerCameron Dale <camrdale@gmail.com>
Mon, 31 Mar 2008 23:03:05 +0000 (16:03 -0700)
TODO
apt_p2p/HTTPServer.py

diff --git a/TODO b/TODO
index b0724b4..67eda4e 100644 (file)
--- a/TODO
+++ b/TODO
@@ -11,7 +11,7 @@ Packages.diff files need to be considered.
 The Packages.diff/Index files contain hashes of Packages.diff/rred.gz 
 files, which themselves contain diffs to the Packages files previously 
 downloaded. Apt will request these files for the testing/unstable 
-distributions. They need to either be ignored, or dealt with properly by 
+distributions. They need to be dealt with properly by 
 adding them to the tracking done by the AptPackages module.
 
 
index 3a9a3a3..224f411 100644 (file)
@@ -232,7 +232,11 @@ class TopLevel(resource.Resource):
         if request.remoteAddr.host != "127.0.0.1":
             log.msg('Blocked illegal access to %s from %s' % (request.uri, request.remoteAddr))
             return None, ()
-            
+        
+        # Block access to index .diff files (for now)
+        if 'Packages.diff' in segments or 'Sources.diff' in segments:
+            return None, ()
+         
         if len(name) > 1:
             # It's a request from apt
             return FileDownloader(self.directory.path, self.manager), segments[0:]
@@ -258,7 +262,7 @@ if __name__ == '__builtin__':
                 return [{'pieces': 'abcdefghij0123456789\xca\xec\xb8\x0c\x00\xe7\x07\xf8~])\x8f\x9d\xe5_B\xff\x1a\xc4!'}]
             return [{'path': FilePath(os.path.expanduser('~/school/optout'))}]
     
-    t = TopLevel(FilePath(os.path.expanduser('~')), DB(), None)
+    t = TopLevel(FilePath(os.path.expanduser('~')), DB(), None, 0)
     factory = t.getHTTPFactory()
     
     # Standard twisted application Boilerplate