From: Cameron Dale Date: Mon, 31 Mar 2008 23:03:05 +0000 (-0700) Subject: Return 404s to all requests for Packages.diff and Sources.diff. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bb36ae6bc51a6a97ff06e627ce716c3915f8439d;p=quix0rs-apt-p2p.git Return 404s to all requests for Packages.diff and Sources.diff. --- diff --git a/TODO b/TODO index b0724b4..67eda4e 100644 --- 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. diff --git a/apt_p2p/HTTPServer.py b/apt_p2p/HTTPServer.py index 3a9a3a3..224f411 100644 --- a/apt_p2p/HTTPServer.py +++ b/apt_p2p/HTTPServer.py @@ -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