Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
27468663
Kaydet (Commit)
27468663
authored
Eki 11, 2009
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed Issue6894, urllib2 doesn't respect "no_proxy" environment
üst
723fb3ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
test_urllib2.py
Lib/test/test_urllib2.py
+16
-0
urllib2.py
Lib/urllib2.py
+7
-1
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
27468663
...
...
@@ -943,6 +943,22 @@ class HandlerTests(unittest.TestCase):
self
.
assertEqual
([(
handlers
[
0
],
"http_open"
)],
[
tup
[
0
:
2
]
for
tup
in
o
.
calls
])
def
test_proxy_no_proxy
(
self
):
os
.
environ
[
'no_proxy'
]
=
'python.org'
o
=
OpenerDirector
()
ph
=
urllib2
.
ProxyHandler
(
dict
(
http
=
"proxy.example.com"
))
o
.
add_handler
(
ph
)
req
=
Request
(
"http://www.perl.org/"
)
self
.
assertEqual
(
req
.
get_host
(),
"www.perl.org"
)
r
=
o
.
open
(
req
)
self
.
assertEqual
(
req
.
get_host
(),
"proxy.example.com"
)
req
=
Request
(
"http://www.python.org"
)
self
.
assertEqual
(
req
.
get_host
(),
"www.python.org"
)
r
=
o
.
open
(
req
)
self
.
assertEqual
(
req
.
get_host
(),
"www.python.org"
)
del
os
.
environ
[
'no_proxy'
]
def
test_proxy_https
(
self
):
o
=
OpenerDirector
()
ph
=
urllib2
.
ProxyHandler
(
dict
(
https
=
'proxy.example.com:3128'
))
...
...
Lib/urllib2.py
Dosyayı görüntüle @
27468663
...
...
@@ -111,7 +111,7 @@ from urllib import (unwrap, unquote, splittype, splithost, quote,
splitattr
,
ftpwrapper
,
splituser
,
splitpasswd
,
splitvalue
)
# support for FileHandler, proxies via environment variables
from
urllib
import
localhost
,
url2pathname
,
getproxies
from
urllib
import
localhost
,
url2pathname
,
getproxies
,
proxy_bypass
# used in User-Agent header sent
__version__
=
sys
.
version
[:
3
]
...
...
@@ -698,14 +698,20 @@ class ProxyHandler(BaseHandler):
def
proxy_open
(
self
,
req
,
proxy
,
type
):
orig_type
=
req
.
get_type
()
proxy_type
,
user
,
password
,
hostport
=
_parse_proxy
(
proxy
)
if
proxy_type
is
None
:
proxy_type
=
orig_type
if
req
.
host
and
proxy_bypass
(
req
.
host
):
return
None
if
user
and
password
:
user_pass
=
'
%
s:
%
s'
%
(
unquote
(
user
),
unquote
(
password
))
creds
=
base64
.
b64encode
(
user_pass
)
.
strip
()
req
.
add_header
(
'Proxy-authorization'
,
'Basic '
+
creds
)
hostport
=
unquote
(
hostport
)
req
.
set_proxy
(
hostport
,
proxy_type
)
if
orig_type
==
proxy_type
or
orig_type
==
'https'
:
# let other handlers take care of it
return
None
...
...
Misc/NEWS
Dosyayı görüntüle @
27468663
...
...
@@ -398,6 +398,8 @@ Core and Builtins
Library
-------
- Issue #6894: Fixed the issue urllib2 doesn't respect "no_proxy" environment
- Issue #7086: Added TCP support to SysLogHandler, and tidied up some
anachronisms in the code which were a relic of 1.5.2 compatibility.
...
...
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