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
01df458f
Commit
01df458f
authored
Jun 03, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Host: header to URL request.
parent
e73db46f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
Lib/urllib.py
Lib/urllib.py
+5
-1
No files found.
Lib/urllib.py
View file @
01df458f
...
@@ -201,11 +201,14 @@ class URLopener:
...
@@ -201,11 +201,14 @@ class URLopener:
if
type
(
url
)
is
type
(
""
):
if
type
(
url
)
is
type
(
""
):
host
,
selector
=
splithost
(
url
)
host
,
selector
=
splithost
(
url
)
user_passwd
,
host
=
splituser
(
host
)
user_passwd
,
host
=
splituser
(
host
)
realhost
=
host
else
:
else
:
host
,
selector
=
url
host
,
selector
=
url
urltype
,
rest
=
splittype
(
selector
)
urltype
,
rest
=
splittype
(
selector
)
user_passwd
=
None
user_passwd
=
None
if
string
.
lower
(
urltype
)
==
'http'
:
if
string
.
lower
(
urltype
)
!=
'http'
:
realhost
=
None
else
:
realhost
,
rest
=
splithost
(
rest
)
realhost
,
rest
=
splithost
(
rest
)
user_passwd
,
realhost
=
splituser
(
realhost
)
user_passwd
,
realhost
=
splituser
(
realhost
)
if
user_passwd
:
if
user_passwd
:
...
@@ -227,6 +230,7 @@ class URLopener:
...
@@ -227,6 +230,7 @@ class URLopener:
else
:
else
:
h
.
putrequest
(
'GET'
,
selector
)
h
.
putrequest
(
'GET'
,
selector
)
if
auth
:
h
.
putheader
(
'Authorization'
,
'Basic %s'
%
auth
)
if
auth
:
h
.
putheader
(
'Authorization'
,
'Basic %s'
%
auth
)
if
realhost
:
h
.
putheader
(
'Host'
,
realhost
)
for
args
in
self
.
addheaders
:
apply
(
h
.
putheader
,
args
)
for
args
in
self
.
addheaders
:
apply
(
h
.
putheader
,
args
)
h
.
endheaders
()
h
.
endheaders
()
if
data
is
not
None
:
if
data
is
not
None
:
...
...
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