Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f7cb5d9
Commit
3f7cb5d9
authored
Jul 11, 2004
by
Kurt B. Kaiser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch [ 972332 ] urllib2 FTPHandler bugs / John J. Lee
Modified Files: urllib2.py test/test_urllib2.py
parent
e2465087
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
Lib/test/test_urllib2.py
Lib/test/test_urllib2.py
+7
-10
Lib/urllib2.py
Lib/urllib2.py
+4
-2
No files found.
Lib/test/test_urllib2.py
View file @
3f7cb5d9
...
...
@@ -314,15 +314,12 @@ class HandlerTests(unittest.TestCase):
(
"ftp://localhost/foo/bar/baz.html"
,
"localhost"
,
ftplib
.
FTP_PORT
,
"I"
,
[
"foo"
,
"bar"
],
"baz.html"
,
"text/html"
),
# XXXX Bug: FTPHandler tries to gethostbyname "localhost:80", with the
# port still there.
## ("ftp://localhost:80/foo/bar/",
## "localhost", 80, "D",
## ["foo", "bar"], "", None),
# XXXX bug: second use of splitattr() in FTPHandler should be splitvalue()
## ("ftp://localhost/baz.gif;type=a",
## "localhost", ftplib.FTP_PORT, "A",
## [], "baz.gif", "image/gif"),
(
"ftp://localhost:80/foo/bar/"
,
"localhost"
,
80
,
"D"
,
[
"foo"
,
"bar"
],
""
,
None
),
(
"ftp://localhost/baz.gif;type=a"
,
"localhost"
,
ftplib
.
FTP_PORT
,
"A"
,
[],
"baz.gif"
,
None
),
# XXX really this should guess image/gif
]:
r
=
h
.
ftp_open
(
Request
(
url
))
# ftp authentication not yet implemented by FTPHandler
...
...
@@ -333,7 +330,7 @@ class HandlerTests(unittest.TestCase):
self
.
assertEqual
(
h
.
ftpwrapper
.
filename
,
filename
)
self
.
assertEqual
(
h
.
ftpwrapper
.
filetype
,
type_
)
headers
=
r
.
info
()
self
.
assertEqual
(
headers
[
"Content-type"
]
,
mimetype
)
self
.
assertEqual
(
headers
.
get
(
"Content-type"
)
,
mimetype
)
self
.
assertEqual
(
int
(
headers
[
"Content-length"
]),
len
(
data
))
def
test_file
(
self
):
...
...
Lib/urllib2.py
View file @
3f7cb5d9
...
...
@@ -116,7 +116,7 @@ except ImportError:
# not sure how many of these need to be gotten rid of
from
urllib
import
unwrap
,
unquote
,
splittype
,
splithost
,
\
addinfourl
,
splitport
,
splitgophertype
,
splitquery
,
\
splitattr
,
ftpwrapper
,
noheaders
,
splituser
,
splitpasswd
splitattr
,
ftpwrapper
,
noheaders
,
splituser
,
splitpasswd
,
splitvalue
# support for FileHandler, proxies via environment variables
from
urllib
import
localhost
,
url2pathname
,
getproxies
...
...
@@ -1143,6 +1143,8 @@ class FTPHandler(BaseHandler):
host
,
port
=
splitport
(
host
)
if
port
is
None
:
port
=
ftplib
.
FTP_PORT
else
:
port
=
int
(
port
)
# username/password handling
user
,
host
=
splituser
(
host
)
...
...
@@ -1168,7 +1170,7 @@ class FTPHandler(BaseHandler):
fw
=
self
.
connect_ftp
(
user
,
passwd
,
host
,
port
,
dirs
)
type
=
file
and
'I'
or
'D'
for
attr
in
attrs
:
attr
,
value
=
split
attr
(
attr
)
attr
,
value
=
split
value
(
attr
)
if
attr
.
lower
()
==
'type'
and
\
value
in
(
'a'
,
'A'
,
'i'
,
'I'
,
'd'
,
'D'
):
type
=
value
.
upper
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment