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
b5f2e5cc
Kaydet (Commit)
b5f2e5cc
authored
May 08, 2006
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1479302: Make urllib2 digest auth and basic auth play together.
üst
a166a916
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
test_urllib2.py
Lib/test/test_urllib2.py
+21
-0
urllib2.py
Lib/urllib2.py
+0
-3
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
b5f2e5cc
...
...
@@ -779,6 +779,27 @@ class HandlerTests(unittest.TestCase):
"proxy.example.com:3128"
,
)
def
test_basic_and_digest_auth_handlers
(
self
):
# HTTPDigestAuthHandler threw an exception if it couldn't handle a 40*
# response (http://python.org/sf/1479302), where it should instead
# return None to allow another handler (especially
# HTTPBasicAuthHandler) to handle the response.
class
TestDigestAuthHandler
(
urllib2
.
HTTPDigestAuthHandler
):
handler_order
=
400
# strictly before HTTPBasicAuthHandler
opener
=
OpenerDirector
()
password_manager
=
MockPasswordManager
()
digest_handler
=
TestDigestAuthHandler
(
password_manager
)
basic_handler
=
urllib2
.
HTTPBasicAuthHandler
(
password_manager
)
opener
.
add_handler
(
digest_handler
)
realm
=
"ACME Networks"
http_handler
=
MockHTTPHandler
(
401
,
'WWW-Authenticate: Basic realm="
%
s"
\r\n\r\n
'
%
realm
)
self
.
_test_basic_auth
(
opener
,
basic_handler
,
"Authorization"
,
realm
,
http_handler
,
password_manager
,
"http://acme.example.com/protected"
,
"http://acme.example.com/protected"
,
)
def
_test_basic_auth
(
self
,
opener
,
auth_handler
,
auth_header
,
realm
,
http_handler
,
password_manager
,
request_url
,
protected_url
):
...
...
Lib/urllib2.py
Dosyayı görüntüle @
b5f2e5cc
...
...
@@ -846,9 +846,6 @@ class AbstractDigestAuthHandler:
scheme
=
authreq
.
split
()[
0
]
if
scheme
.
lower
()
==
'digest'
:
return
self
.
retry_http_digest_auth
(
req
,
authreq
)
else
:
raise
ValueError
(
"AbstractDigestAuthHandler doesn't know "
"about
%
s"
%
(
scheme
))
def
retry_http_digest_auth
(
self
,
req
,
auth
):
token
,
challenge
=
auth
.
split
(
' '
,
1
)
...
...
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