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
40f12ab0
Kaydet (Commit)
40f12ab0
authored
Ara 28, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Backport Python 3.2 fix for issue #12065, and add another test for SSLSocket.connect_ex().
üst
c4051aa8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
9 deletions
+42
-9
ssl.py
Lib/ssl.py
+11
-9
test_ssl.py
Lib/test/test_ssl.py
+28
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ssl.py
Dosyayı görüntüle @
40f12ab0
...
...
@@ -313,17 +313,19 @@ class SSLSocket(socket):
self
.
cert_reqs
,
self
.
ssl_version
,
self
.
ca_certs
,
self
.
ciphers
)
try
:
socket
.
connect
(
self
,
addr
)
if
self
.
do_handshake_on_connect
:
self
.
do_handshake
()
except
socket_error
as
e
:
if
return_errno
:
r
eturn
e
.
errno
r
c
=
socket
.
connect_ex
(
self
,
addr
)
else
:
self
.
_sslobj
=
None
raise
e
self
.
_connected
=
True
return
0
rc
=
None
socket
.
connect
(
self
,
addr
)
if
not
rc
:
if
self
.
do_handshake_on_connect
:
self
.
do_handshake
()
self
.
_connected
=
True
return
rc
except
socket_error
:
self
.
_sslobj
=
None
raise
def
connect
(
self
,
addr
):
"""Connects to remote ADDR, and then wraps the connection in
...
...
Lib/test/test_ssl.py
Dosyayı görüntüle @
40f12ab0
...
...
@@ -280,6 +280,34 @@ class NetworkedTests(unittest.TestCase):
finally
:
s
.
close
()
def
test_timeout_connect_ex
(
self
):
# Issue #12065: on a timeout, connect_ex() should return the original
# errno (mimicking the behaviour of non-SSL sockets).
with
test_support
.
transient_internet
(
"svn.python.org"
):
s
=
ssl
.
wrap_socket
(
socket
.
socket
(
socket
.
AF_INET
),
cert_reqs
=
ssl
.
CERT_REQUIRED
,
ca_certs
=
SVN_PYTHON_ORG_ROOT_CERT
,
do_handshake_on_connect
=
False
)
try
:
s
.
settimeout
(
0.0000001
)
rc
=
s
.
connect_ex
((
'svn.python.org'
,
443
))
if
rc
==
0
:
self
.
skipTest
(
"svn.python.org responded too quickly"
)
self
.
assertIn
(
rc
,
(
errno
.
EAGAIN
,
errno
.
EWOULDBLOCK
))
finally
:
s
.
close
()
def
test_connect_ex_error
(
self
):
with
test_support
.
transient_internet
(
"svn.python.org"
):
s
=
ssl
.
wrap_socket
(
socket
.
socket
(
socket
.
AF_INET
),
cert_reqs
=
ssl
.
CERT_REQUIRED
,
ca_certs
=
SVN_PYTHON_ORG_ROOT_CERT
)
try
:
self
.
assertEqual
(
errno
.
ECONNREFUSED
,
s
.
connect_ex
((
"svn.python.org"
,
444
)))
finally
:
s
.
close
()
@unittest.skipIf
(
os
.
name
==
"nt"
,
"Can't use a socket as a file under Windows"
)
def
test_makefile_close
(
self
):
# Issue #5238: creating a file-like object with makefile() shouldn't
...
...
Misc/NEWS
Dosyayı görüntüle @
40f12ab0
...
...
@@ -175,6 +175,9 @@ Core and Builtins
Library
-------
- Issue #12065: connect_ex() on an SSL socket now returns the original errno
when the socket'
s
timeout
expires
(
it
used
to
return
None
).
-
Issue
#
16504
:
IDLE
now
catches
SyntaxErrors
raised
by
tokenizer
.
Patch
by
Roger
Serwy
.
...
...
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