This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cannot handle http_proxy with user:pass@
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doko, gvanrossum, jonico, loewis
Priority: low Keywords:

Created on 2001-12-21 00:22 by doko, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (4)
msg8402 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2001-12-21 00:22
[please CC 120013@bugs.debian.org; the original report 
can be found at http://bugs.debian.org/120013 ]

I tried to use an http_proxy variable which looks 
like: 
http://user:pass@proxy:3128/

with pass like \jkIoPd{

And I got this error :

Traceback (most recent call last):
  File "/usr/bin/reportbug", line 1146, in ?
    main()
  File "/usr/bin/reportbug", line 628, in main
    http_proxy)
  File "/usr/lib/site-python/reportbug_ui_text.py", 
line 314, in
  handle_bts_query
    archived=archived)
  File "/usr/lib/site-python/debianbts.py", line 575, 
in get_reports
    result = get_cgi_reports(package, system, 
http_proxy, archived)
  File "/usr/lib/site-python/debianbts.py", line 494, 
in get_cgi_reports
    page = urlopen(url, proxies=proxies)
  File "/usr/lib/site-python/debianbts.py", line 382, 
in urlopen
    return _urlopener.open(url)
  File "/usr/lib/python2.1/urllib.py", line 176, in 
open
    return getattr(self, name)(url)
  File "/usr/lib/python2.1/urllib.py", line 277, in 
open_http
    h = httplib.HTTP(host)
  File "/usr/lib/python2.1/httplib.py", line 663, in 
__init__
    self._conn = self._connection_class(host, port)
  File "/usr/lib/python2.1/httplib.py", line 342, in 
__init__
    self._set_hostport(host, port)
  File "/usr/lib/python2.1/httplib.py", line 348, in 
_set_hostport
    port = int(host[i+1:])
ValueError: invalid literal for int(): \jkIoPd
{@proxy:3128

But if I use http_proxy=http://10.0.0.1:3128/, it 
works well.
msg8403 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-12-28 22:28
Logged In: YES 
user_id=6380

This is a feature request. If someone submits a patch, we'll
happily apply it.

It looks like urllib2 already supports this feature; you
could try using that.
msg8404 - (view) Author: Johannes Nicolai (jonico) Date: 2005-11-05 17:09
Logged In: YES 
user_id=863272

I have proposed a patch for this in the patch section: 
1349118 is the number of the patch 
URL: 
https://sourceforge.net/tracker/index.php?func=detail&aid=1349118&group_id=5470&atid=305470 
The patch also solves some other issues with proxies (now it 
correct handles protocols, where a proxy was specified but not 
supported and https proxies will also be used if a host requires 
www-authentification) 
msg8405 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-01-24 15:52
Logged In: YES 
user_id=21627

Fixed with said patch.
History
Date User Action Args
2022-04-10 16:04:48adminsetgithub: 35808
2001-12-21 00:22:47dokocreate