Here's a quick hack to support HTTP Basic authorization in apt-proxy
that works for me.

Disclaimer: I have no familiarity with Twisted and only glanced at RFC
2617 before implementing this, so I'm overly confident this patch is
correct...

-- 
Society is never going to make any progress until we all learn to
pretend to like each other.
--- apt-proxy-1.9.30.old/apt_proxy/apt_proxy.py 2005-05-19 09:41:18.000000000 
-0700
+++ apt-proxy-1.9.30/apt_proxy/apt_proxy.py     2005-06-01 14:38:07.000000000 
-0700
@@ -29,6 +29,7 @@
 from twisted.python.failure import Failure
 import memleak
 from twisted.internet import error
+import base64
 #from posixfile import SEEK_SET, SEEK_CUR, SEEK_END
 #since posixfile is considered obsolete I'll define the SEEK_* constants
 #myself.
@@ -586,6 +587,11 @@
             
         self.sendHeader('host', self.request.backendServer.host)
 
+        if self.request.backendServer.username:
+            self.sendHeader('authorization', "Basic "
+                            + 
base64.encodestring(self.request.backendServer.username + ":"
+                                                  + 
self.request.backendServer.password))
+
         if self.local_mtime != None:
             datetime = http.datetimeToString(self.local_mtime)
             self.sendHeader('if-modified-since', datetime)

Reply via email to