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
d3f193fe
Commit
d3f193fe
authored
Mar 20, 2001
by
Moshe Zadka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Fixing the password-proxy bug
* Not sending content-type and content-length twice
parent
6abce91a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
Lib/urllib2.py
Lib/urllib2.py
+8
-7
No files found.
Lib/urllib2.py
View file @
d3f193fe
...
@@ -477,8 +477,8 @@ class ProxyHandler(BaseHandler):
...
@@ -477,8 +477,8 @@ class ProxyHandler(BaseHandler):
host
,
XXX
=
splithost
(
r_type
)
host
,
XXX
=
splithost
(
r_type
)
if
'@'
in
host
:
if
'@'
in
host
:
user_pass
,
host
=
host
.
split
(
'@'
,
1
)
user_pass
,
host
=
host
.
split
(
'@'
,
1
)
user_pass
=
base64
.
encode
_string
(
unquote
(
user_passw
)).
strip
()
user_pass
=
base64
.
encode
string
(
unquote
(
user_pass
)).
strip
()
req
.
add
header
(
'Proxy-Authorization'
,
user_pass
)
req
.
add
_header
(
'Proxy-Authorization'
,
'Basic '
+
user_pass
)
host
=
unquote
(
host
)
host
=
unquote
(
host
)
req
.
set_proxy
(
host
,
type
)
req
.
set_proxy
(
host
,
type
)
if
orig_type
==
type
:
if
orig_type
==
type
:
...
@@ -781,7 +781,7 @@ def encode_digest(digest):
...
@@ -781,7 +781,7 @@ def encode_digest(digest):
class
AbstractHTTPHandler
(
BaseHandler
):
class
AbstractHTTPHandler
(
BaseHandler
):
def
do_open
(
self
,
http_class
,
req
):
def
do_open
(
self
,
http_class
,
req
):
host
=
req
.
get_host
()
host
=
urlparse
.
urlparse
(
req
.
get_full_url
())[
1
]
if
not
host
:
if
not
host
:
raise
URLError
(
'no host given'
)
raise
URLError
(
'no host given'
)
...
@@ -790,15 +790,16 @@ class AbstractHTTPHandler(BaseHandler):
...
@@ -790,15 +790,16 @@ class AbstractHTTPHandler(BaseHandler):
if
req
.
has_data
():
if
req
.
has_data
():
data
=
req
.
get_data
()
data
=
req
.
get_data
()
h
.
putrequest
(
'POST'
,
req
.
get_selector
())
h
.
putrequest
(
'POST'
,
req
.
get_selector
())
h
.
putheader
(
'Content-type'
,
if
not
req
.
headers
.
has_key
(
'Content-type'
):
'application/x-www-form-urlencoded'
)
h
.
putheader
(
'Content-type'
,
h
.
putheader
(
'Content-length'
,
'%d'
%
len
(
data
))
'application/x-www-form-urlencoded'
)
if
not
req
.
headers
.
has_key
(
'Content-length'
):
h
.
putheader
(
'Content-length'
,
'%d'
%
len
(
data
))
else
:
else
:
h
.
putrequest
(
'GET'
,
req
.
get_selector
())
h
.
putrequest
(
'GET'
,
req
.
get_selector
())
except
socket
.
error
,
err
:
except
socket
.
error
,
err
:
raise
URLError
(
err
)
raise
URLError
(
err
)
# XXX proxies would have different host here
h
.
putheader
(
'Host'
,
host
)
h
.
putheader
(
'Host'
,
host
)
for
args
in
self
.
parent
.
addheaders
:
for
args
in
self
.
parent
.
addheaders
:
h
.
putheader
(
*
args
)
h
.
putheader
(
*
args
)
...
...
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