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
1bc7068d
Kaydet (Commit)
1bc7068d
authored
Ara 02, 2013
tarafından
Christian Heimes
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19784: poplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.
üst
b8a3f581
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
poplib.rst
Doc/library/poplib.rst
+9
-0
poplib.py
Lib/poplib.py
+6
-2
test_poplib.py
Lib/test/test_poplib.py
+8
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/poplib.rst
Dosyayı görüntüle @
1bc7068d
...
...
@@ -53,6 +53,10 @@ The :mod:`poplib` module provides two classes:
.. versionchanged:: 3.2
*context* parameter added.
.. versionchanged:: 3.4
The class now supports hostname check with
:attr:`SSLContext.check_hostname` and *Server Name Indicator* (see
:data:`~ssl.HAS_SNI`).
One exception is defined as an attribute of the :mod:`poplib` module:
...
...
@@ -198,6 +202,11 @@ An :class:`POP3` instance has the following methods:
.. versionadded:: 3.4
.. versionchanged:: 3.4
The method now supports hostname check with
:attr:`SSLContext.check_hostname` and *Server Name Indicator* (see
:data:`~ssl.HAS_SNI`).
Instances of :class:`POP3_SSL` have no additional methods. The interface of this
subclass is identical to its parent.
...
...
Lib/poplib.py
Dosyayı görüntüle @
1bc7068d
...
...
@@ -387,7 +387,9 @@ class POP3:
if
context
is
None
:
context
=
ssl
.
_create_stdlib_context
()
resp
=
self
.
_shortcmd
(
'STLS'
)
self
.
sock
=
context
.
wrap_socket
(
self
.
sock
)
server_hostname
=
self
.
host
if
ssl
.
HAS_SNI
else
None
self
.
sock
=
context
.
wrap_socket
(
self
.
sock
,
server_hostname
=
server_hostname
)
self
.
file
=
self
.
sock
.
makefile
(
'rb'
)
self
.
_tls_established
=
True
return
resp
...
...
@@ -428,7 +430,9 @@ if HAVE_SSL:
def
_create_socket
(
self
,
timeout
):
sock
=
POP3
.
_create_socket
(
self
,
timeout
)
sock
=
self
.
context
.
wrap_socket
(
sock
)
server_hostname
=
self
.
host
if
ssl
.
HAS_SNI
else
None
sock
=
self
.
context
.
wrap_socket
(
sock
,
server_hostname
=
server_hostname
)
return
sock
def
stls
(
self
,
keyfile
=
None
,
certfile
=
None
,
context
=
None
):
...
...
Lib/test/test_poplib.py
Dosyayı görüntüle @
1bc7068d
...
...
@@ -23,7 +23,8 @@ if hasattr(poplib, 'POP3_SSL'):
import
ssl
SUPPORTS_SSL
=
True
CERTFILE
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
)
or
os
.
curdir
,
"keycert.pem"
)
CERTFILE
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
)
or
os
.
curdir
,
"keycert3.pem"
)
CAFILE
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
)
or
os
.
curdir
,
"pycacert.pem"
)
requires_ssl
=
skipUnless
(
SUPPORTS_SSL
,
'SSL not supported'
)
# the dummy data returned by server when LIST and RETR commands are issued
...
...
@@ -332,6 +333,12 @@ class TestPOP3Class(TestCase):
def
test_stls_context
(
self
):
expected
=
b
'+OK Begin TLS negotiation'
ctx
=
ssl
.
SSLContext
(
ssl
.
PROTOCOL_TLSv1
)
ctx
.
load_verify_locations
(
CAFILE
)
ctx
.
verify_mode
=
ssl
.
CERT_REQUIRED
ctx
.
check_hostname
=
True
with
self
.
assertRaises
(
ssl
.
CertificateError
):
resp
=
self
.
client
.
stls
(
context
=
ctx
)
self
.
client
=
poplib
.
POP3
(
"localhost"
,
self
.
server
.
port
,
timeout
=
3
)
resp
=
self
.
client
.
stls
(
context
=
ctx
)
self
.
assertEqual
(
resp
,
expected
)
...
...
Misc/NEWS
Dosyayı görüntüle @
1bc7068d
...
...
@@ -18,6 +18,9 @@ Core and Builtins
Library
-------
- Issue #19784: poplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.
- Issue #19782: imaplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.
...
...
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