[Python-checkins] python/dist/src/Lib urllib2.py,1.53.6.3,1.53.6.4
loewis at users.sourceforge.net
loewis at users.sourceforge.net
Sun Feb 15 16:18:49 EST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26006/Lib
Modified Files:
Tag: release23-maint
urllib2.py
Log Message:
Patch #711838: Allow non-anonymous ftp urls in urllib2.
Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.53.6.3
retrieving revision 1.53.6.4
diff -C2 -d -r1.53.6.3 -r1.53.6.4
*** urllib2.py 15 Feb 2004 20:52:00 -0000 1.53.6.3
--- urllib2.py 15 Feb 2004 21:18:47 -0000 1.53.6.4
***************
*** 115,119 ****
from urllib import unwrap, unquote, splittype, splithost, \
addinfourl, splitport, splitgophertype, splitquery, \
! splitattr, ftpwrapper, noheaders
# support for FileHandler, proxies via environment variables
--- 115,119 ----
from urllib import unwrap, unquote, splittype, splithost, \
addinfourl, splitport, splitgophertype, splitquery, \
! splitattr, ftpwrapper, noheaders, splituser, splitpasswd
# support for FileHandler, proxies via environment variables
***************
*** 1013,1024 ****
if not host:
raise IOError, ('ftp error', 'no host given')
! # XXX handle custom username & password
try:
host = socket.gethostbyname(host)
except socket.error, msg:
raise URLError(msg)
- host, port = splitport(host)
- if port is None:
- port = ftplib.FTP_PORT
path, attrs = splitattr(req.get_selector())
dirs = path.split('/')
--- 1013,1034 ----
if not host:
raise IOError, ('ftp error', 'no host given')
! host, port = splitport(host)
! if port is None:
! port = ftplib.FTP_PORT
!
! # username/password handling
! user, host = splituser(host)
! if user:
! user, passwd = splitpasswd(user)
! else:
! passwd = None
! host = unquote(host)
! user = unquote(user or '')
! passwd = unquote(passwd or '')
!
try:
host = socket.gethostbyname(host)
except socket.error, msg:
raise URLError(msg)
path, attrs = splitattr(req.get_selector())
dirs = path.split('/')
***************
*** 1027,1031 ****
if dirs and not dirs[0]:
dirs = dirs[1:]
- user = passwd = '' # XXX
try:
fw = self.connect_ftp(user, passwd, host, port, dirs)
--- 1037,1040 ----
More information about the Python-checkins
mailing list