Only in apt-proxy-1.9.35: apbuilddoc
Only in apt-proxy-1.9.35: apt-proxy.conf.test
diff -u -r apt-proxy-1.9.35/apt_proxy/apt_proxy.py apt_proxy/apt_proxy/apt_proxy.py
--- apt-proxy-1.9.35/apt_proxy/apt_proxy.py	Tue Aug 15 02:00:45 2006
+++ apt_proxy/apt_proxy/apt_proxy.py	Wed Nov 12 15:44:59 2008
@@ -77,6 +77,12 @@
         #self.get_packages_db().load()
 
     def addURI(self, uri):
+        
+        for backend in self.uris:
+           if uri.find(backend.uri) > -1:
+              log.debug("Skip addition of duplicate backend (%s) => (%s)" % (uri, backend.uri))
+              return
+
         newBackend = BackendServer(self, uri)
         self.uris.append(newBackend)
 
@@ -181,7 +187,7 @@
             is_rsync=0
 
         self.scheme, netloc, self.path, parameters, \
-                     query, fragment = urlparse.urlparse(uri)
+                     self.query, fragment = urlparse.urlparse(uri)
         if is_rsync:
             self.scheme = 'rsync'
 
diff -u -r apt-proxy-1.9.35/apt_proxy/fetchers.py apt_proxy/apt_proxy/fetchers.py
--- apt-proxy-1.9.35/apt_proxy/fetchers.py	Wed Dec 27 14:33:47 2006
+++ apt_proxy/apt_proxy/fetchers.py	Wed Nov 12 15:44:59 2008
@@ -70,7 +70,8 @@
                 # The attempt to retrieve a file from the BackendServer failed.
                 log.debug("no more Backends", "fetcher")
                 return False
-        self.connectToBackend()
+
+        return self.connectToBackend()
 
     def connectToBackend(self):
         log.debug('Connecting to backend server %s' % (self.backendServer), 'fetcher')
@@ -223,6 +224,11 @@
         # TODO - failover?
         self.download_failed(http.NOT_FOUND, "file not found on backend")
 
+    def fetcher_redirected(self, code, uri):
+        log.msg("Fetcher got redirect code (%s)" % (code), 'fetcher')
+        self.backend.addURI(uri)
+        self.fail_over(code, "Redirect requested")
+
     def fetcher_internal_error(self, reason):
         log.msg("(%s) internal error: %s" % (self.backendServer.path, reason), 'fetcher')
         self.download_failed(http.INTERNAL_SERVER_ERROR, reason)
@@ -336,6 +342,12 @@
                 serverpath = serverpath + ":" + str(backendServer.port)
             serverpath = serverpath + "/" + backendServer.path 
 
+        if backendServer.query:
+            serverpath = serverpath + "?" + backendServer.query
+
+        #kill duplicate slashes
+        serverpath = serverpath.rstrip("/")
+
         #self.sendCommand(self.request.method, 
         self.sendCommand("GET", serverpath + "/" + uri)
 
@@ -362,6 +374,20 @@
             #self.transport.loseConnection()
         self.fetcher.download_complete()
 
+    def fetcher_redirected(self, code, uri):
+        if self.finished: 
+            return
+        log.debug("Has to be redirected to %s" % (uri),'http_client')
+        self.finished = True
+
+#        if uri.find(self.uri) > -1:
+#            log.debug("Found full redirect address", 'http_client')
+        uri = uri.replace(self.uri,'')
+#        else
+#            log.debug("Found server-only redirect address, completing it to full", 'http_client')
+
+        self.fetcher.fetcher_redirected(code, uri)
+
     def handleStatus(self, version, code, message):
         __pychecker__ = 'unusednames=version,message'
         log.debug('handleStatus %s - %s' % (code, message), 'http_client')
@@ -380,6 +406,9 @@
             self.fetcher.file_not_found()
         elif self.http_status == http.OK:
             self.download_complete()
+        elif self.http_status == http.MOVED_PERMANENTLY or self.http_status == http.FOUND or self.http_status == http.SEE_OTHER:
+            log.debug("Redirect code found: %s" % (self.http_status),'http_client')
+            self.fetcher_redirected(self.http_status, self.http_location)
         else:
             log.debug("Unknown status code: %s" % (self.http_status),'http_client')
             self.fetcher.fetcher_internal_error("Unknown status code: %s" % (self.http_status))
@@ -402,6 +431,9 @@
             elif value == "keep-alive":
                 log.debug('will not close on completion', 'http_client')
                 self.close_on_completion = False
+        elif key == 'location':
+            log.debug("Redirect location (%s)" % (value), 'http_client')
+            self.http_location = value
 
     #def handleEndHeaders(self):
         #if self.http_status == http.NOT_MODIFIED:
Only in apt-proxy-1.9.35/apt_proxy: plugins.tml
Only in apt-proxy-1.9.35/apt_proxy: test
Only in apt-proxy-1.9.35/apt_proxy: twisted_compat
Only in apt-proxy-1.9.35: aptest
Only in apt-proxy-1.9.35: aptest.testdb
Only in apt-proxy-1.9.35: aptproxy.kdevelop
Only in apt-proxy-1.9.35: bin
Only in apt-proxy-1.9.35: debian
Only in apt-proxy-1.9.35: doc
Only in apt-proxy-1.9.35: pychecker
Only in apt-proxy-1.9.35: README
Only in apt-proxy-1.9.35: runtests
