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
b46247be
Kaydet (Commit)
b46247be
authored
Ara 07, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.4 (#22959)
üst
5db1bb81
a090f01b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
10 deletions
+22
-10
http.client.rst
Doc/library/http.client.rst
+3
-8
client.py
Lib/http/client.py
+2
-2
test_httplib.py
Lib/test/test_httplib.py
+14
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/http.client.rst
Dosyayı görüntüle @
b46247be
...
...
@@ -69,17 +69,12 @@ The module provides the following classes:
*key_file* and *cert_file* are deprecated, please use
:meth:`ssl.SSLContext.load_cert_chain` instead, or let
:func:`ssl.create_default_context` select the system's trusted CA
certificates for you.
certificates for you. The *check_hostname* parameter is also deprecated; the
:attr:`SSLContext.check_hostname` attribute of *context* should be used
instead.
Please read :ref:`ssl-security` for more information on best practices.
.. note::
If *context* is specified and has a :attr:`~ssl.SSLContext.verify_mode`
of either :data:`~ssl.CERT_OPTIONAL` or :data:`~ssl.CERT_REQUIRED`, then
by default *host* is matched against the host name(s) allowed by the
server's certificate. If you want to change that behaviour, you can
explicitly set *check_hostname* to False.
.. versionchanged:: 3.2
*source_address*, *context* and *check_hostname* were added.
...
...
Lib/http/client.py
Dosyayı görüntüle @
b46247be
...
...
@@ -1274,8 +1274,8 @@ else:
context
=
ssl
.
_create_default_https_context
()
will_verify
=
context
.
verify_mode
!=
ssl
.
CERT_NONE
if
check_hostname
is
None
:
check_hostname
=
will_verify
el
if
check_hostname
and
not
will_verify
:
check_hostname
=
context
.
check_hostname
if
check_hostname
and
not
will_verify
:
raise
ValueError
(
"check_hostname needs a SSL context with "
"either CERT_OPTIONAL or CERT_REQUIRED"
)
if
key_file
or
cert_file
:
...
...
Lib/test/test_httplib.py
Dosyayı görüntüle @
b46247be
...
...
@@ -1113,6 +1113,7 @@ class HTTPSTest(TestCase):
server
=
self
.
make_server
(
CERT_fakehostname
)
context
=
ssl
.
SSLContext
(
ssl
.
PROTOCOL_TLSv1
)
context
.
verify_mode
=
ssl
.
CERT_REQUIRED
context
.
check_hostname
=
True
context
.
load_verify_locations
(
CERT_fakehostname
)
h
=
client
.
HTTPSConnection
(
'localhost'
,
server
.
port
,
context
=
context
)
with
self
.
assertRaises
(
ssl
.
CertificateError
):
...
...
@@ -1123,11 +1124,24 @@ class HTTPSTest(TestCase):
with
self
.
assertRaises
(
ssl
.
CertificateError
):
h
.
request
(
'GET'
,
'/'
)
# With check_hostname=False, the mismatching is ignored
context
.
check_hostname
=
False
h
=
client
.
HTTPSConnection
(
'localhost'
,
server
.
port
,
context
=
context
,
check_hostname
=
False
)
h
.
request
(
'GET'
,
'/nonexistent'
)
resp
=
h
.
getresponse
()
self
.
assertEqual
(
resp
.
status
,
404
)
# The context's check_hostname setting is used if one isn't passed to
# HTTPSConnection.
context
.
check_hostname
=
False
h
=
client
.
HTTPSConnection
(
'localhost'
,
server
.
port
,
context
=
context
)
h
.
request
(
'GET'
,
'/nonexistent'
)
self
.
assertEqual
(
h
.
getresponse
()
.
status
,
404
)
# Passing check_hostname to HTTPSConnection should override the
# context's setting.
h
=
client
.
HTTPSConnection
(
'localhost'
,
server
.
port
,
context
=
context
,
check_hostname
=
True
)
with
self
.
assertRaises
(
ssl
.
CertificateError
):
h
.
request
(
'GET'
,
'/'
)
@unittest.skipIf
(
not
hasattr
(
client
,
'HTTPSConnection'
),
'http.client.HTTPSConnection not available'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
b46247be
...
...
@@ -194,6 +194,9 @@ Core and Builtins
Library
-------
-
Issue
#
22959
:
In
the
constructor
of
http
.
client
.
HTTPSConnection
,
prefer
the
context
's check_hostname attribute over the *check_hostname* parameter.
- Issue #22696: Add function :func:`sys.is_finalizing` to know about
interpreter shutdown.
...
...
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