classification
Title: urllib ftp broken if Win32 proxy
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: facundobatista, gvanrossum, medberry, vimboss
Priority: normal Keywords:

Created on 2002-03-19 19:36 by medberry, last changed 2005-03-21 18:37 by facundobatista. This issue is now closed.

Messages (7)
msg9781 - (view) Author: David Medberry (medberry) Date: 2002-03-19 19:36
If Win32 has a proxy enabled, ftp urls will NOT work in
urllib.

Here is a trace:
Traceback (most recent call last):
  File
"C:\Python22\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 301, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\Python22\Lib\urllib.py", line 1457, in ?
    main()
  File "C:\Python22\Lib\urllib.py", line 1448, in main
    test(args)
  File "C:\Python22\Lib\urllib.py", line 1410, in test
    fn, h = urlretrieve(url, None, reporthook)
  File "C:\Python22\Lib\urllib.py", line 80, in urlretrieve
    return _urlopener.retrieve(url, filename,
reporthook, data)
  File "C:\Python22\Lib\urllib.py", line 210, in retrieve
    fp = self.open(url, data)
  File "C:\Python22\Lib\urllib.py", line 178, in open
    return getattr(self, name)(url)
  File "C:\Python22\Lib\urllib.py", line 438, in open_ftp
    host, path = splithost(url)
  File "C:\Python22\Lib\urllib.py", line 944, in splithost
    match = _hostprog.match(url)
TypeError: expected string or buffer

If the Win32 proxy is removed, it resumes working. In
urllib splithost, url is None or an empty tuple
(instead of the actual url.)

To reproduce, just enable a proxy on Win32 and execute
the "urllib.py -t" selftest. Disable the proxy and it
will be restored.

I haven't got the setup to check if web_proxy or
ftp_proxy on Posix machines causes the same problem.

msg9782 - (view) Author: David Medberry (medberry) Date: 2002-03-19 22:44
Logged In: YES 
user_id=95087

This is _NOT_ a bug under Linux Python 2.2--it works just
fine there. (Makes me curious why it would behave
differently under Windows, but I'm not sure where to look yet.)
msg9783 - (view) Author: David Medberry (medberry) Date: 2002-03-19 22:46
Logged In: YES 
user_id=95087

<bold>Is this bold?</bold>
msg9784 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-31 23:42
Logged In: YES 
user_id=6380

Medberry, can you see if the patch from SF bug 503031
(http://www.python.org/sf/503031) solves your problem?
msg9785 - (view) Author: Bram Moolenaar (vimboss) Date: 2003-02-24 21:01
Logged In: YES 
user_id=57665

Problem is that open_ftp() does not check if the "url"
argument is a string or a tuple.  When ftp_proxy is set it
is a tuple, thus always causes the open() call to fail. 
This is not specific for Win32.

open_http() starts with this check:
       if type(url) is types.StringType:
open_ftp() should do something similar.

This is unrelated to bug 503031.
msg9786 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2004-11-16 00:52
Logged In: YES 
user_id=752496

Please, could you verify if this problem persists in Python 2.3.4
or 2.4?

If yes, in which version? Can you provide a test case?

If the problem is solved, from which version?

Note that if you fail to answer in one month, I'll close this bug
as "Won't fix".

Thank you! 

.    Facundo
msg9787 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005-03-21 18:37
Logged In: YES 
user_id=752496

Deprecated. Reopen only if still happens in 2.3 or newer. 

.    Facundo
History
Date User Action Args
2002-03-19 19:36:49medberrycreate