Package: apt-proxy
Version: 1.9.31
This patch fixes the problem. We can now have
http_proxy = user:[EMAIL PROTECTED]:port
in /etc/apt-proxy/apt-proxy-v2.conf.
This is my first python adventure, it works for me, etc.
There seemed to be a tab that should have been 8 spaces instead. It's "fixed"
in this patch as well. From what I have read, the line shouldn't have been
executed in the correct scope but I haven't verified anything.
--- apt_proxy.py.dist 2005-07-21 17:41:00.000000000 -0400
+++ apt_proxy.py 2005-08-14 21:38:48.128098582 -0400
@@ -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.
@@ -148,7 +149,7 @@
return
log.debug("starting verification: " + exe + " " + str(args))
- self.nullhandle = open("/dev/null", "w")
+ self.nullhandle = open("/dev/null", "w")
self.process = reactor.spawnProcess(self, exe, args, childFDs = { 0:"w", 1:self.nullhandle.fileno(), 2:"r" })
self.laterID = reactor.callLater(self.factory.timeout, self.timedout)
@@ -545,12 +546,18 @@
proxy_host = None
proxy_port = None
+ proxy_auth = None
def activate(self, request):
Fetcher.activate(self, request)
if not self.factory.http_proxy is '':
- (self.proxy_host, self.proxy_port) = request.factory.http_proxy.split(':')
+ if '@' in request.factory.http_proxy:
+ (userpasswd, hostport) = request.factory.http_proxy.split('@')
+ self.proxy_auth = 'Basic ' + base64.encodestring(userpasswd)
+ else:
+ hostport = request.factory.http_proxy
+ (self.proxy_host, self.proxy_port) = hostport.split(':')
if not request.apFetcher:
return
@@ -590,6 +597,9 @@
datetime = http.datetimeToString(self.local_mtime)
self.sendHeader('if-modified-since', datetime)
+ if self.proxy_auth:
+ self.sendHeader('Proxy-Authorization', self.proxy_auth)
+
self.endHeaders()
def handleStatus(self, version, code, message):