Package: python2.3 Version: 2.3.4-19 Followup-For: Bug #233305 Attached is a new version of this patch that should be more robust. This is a often-reported issue against reportbug, so it should be fixed. (See #234558 and the other bugs merged with it.)
-- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.8.1 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages python2.3 depends on: ii libbz2-1.0 1.0.2-3 high-quality block-sorting file co ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an ii libdb4.2 4.2.52-17 Berkeley v4.2 Database Libraries [ ii libncurses5 5.4-4 Shared libraries for terminal hand ii libreadline4 4.3-15 GNU readline and history libraries ii libssl0.9.7 0.9.7e-3 SSL shared libraries ii zlib1g 1:1.2.2-4 compression library - runtime -- no debconf information
--- /usr/lib/python2.3/urllib2.py 2005-01-05 01:41:40.000000000 -0600 +++ urllib2.py 2005-01-27 07:55:33.000000000 -0600 @@ -494,11 +494,16 @@ def proxy_open(self, req, proxy, type): orig_type = req.get_type() type, r_type = splittype(proxy) - host, XXX = splithost(r_type) - if '@' in host: - user_pass, host = host.split('@', 1) - if ':' in user_pass: - user, password = user_pass.split(':', 1) + # Handle host:port format (often used as $http_proxy) + if not type or r_type.isdigit(): + type = orig_type + host = proxy + else: + host, XXX = splithost(r_type) + user, host = splituser(host) + if user: + user, password = splitpasswd(user) + if user and password: user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))) req.add_header('Proxy-authorization', 'Basic ' + user_pass)