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
7cc0fe44
Commit
7cc0fe44
authored
Aug 11, 2010
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Issue9446 - urllib2 tests fail when offline
parent
cb4f47c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
Lib/urllib2.py
Lib/urllib2.py
+7
-1
No files found.
Lib/urllib2.py
View file @
7cc0fe44
...
...
@@ -1259,6 +1259,12 @@ def parse_http_list(s):
return
[
part
.
strip
()
for
part
in
res
]
def
_safe_gethostbyname
(
host
):
try
:
return
socket
.
gethostbyname
(
host
)
except
socket
.
gaierror
:
return
None
class
FileHandler
(
BaseHandler
):
# Use local file or FTP depending on form of URL
def
file_open
(
self
,
req
):
...
...
@@ -1300,7 +1306,7 @@ class FileHandler(BaseHandler):
if
host
:
host
,
port
=
splitport
(
host
)
if
not
host
or
\
(
not
port
and
socket
.
gethostbyname
(
host
)
in
self
.
get_names
()):
(
not
port
and
_safe_
gethostbyname
(
host
)
in
self
.
get_names
()):
if
host
:
origurl
=
'file://'
+
host
+
filename
else
:
...
...
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