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
f6f525b7
Kaydet (Commit)
f6f525b7
authored
Agu 27, 2007
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Stop using string.join (from the module) to ease upgrade to py3k
üst
d6a51e64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
test_ssl.py
Lib/test/test_ssl.py
+10
-10
No files found.
Lib/test/test_ssl.py
Dosyayı görüntüle @
f6f525b7
...
@@ -12,7 +12,6 @@ import os
...
@@ -12,7 +12,6 @@ import os
import
pprint
import
pprint
import
urllib
import
urllib
import
shutil
import
shutil
import
string
import
traceback
import
traceback
# Optionally test SSL support, if we have it in the tested platform
# Optionally test SSL support, if we have it in the tested platform
...
@@ -94,14 +93,14 @@ class ConnectedTests(unittest.TestCase):
...
@@ -94,14 +93,14 @@ class ConnectedTests(unittest.TestCase):
try
:
try
:
s1
.
connect
((
'127.0.0.1'
,
10024
))
s1
.
connect
((
'127.0.0.1'
,
10024
))
except
:
except
:
sys
.
stdout
.
write
(
"connection failure:
\n
"
+
string
.
join
(
sys
.
stdout
.
write
(
"connection failure:
\n
"
+
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
raise
test_support
.
TestFailed
(
"Can't connect to test server"
)
raise
test_support
.
TestFailed
(
"Can't connect to test server"
)
else
:
else
:
try
:
try
:
c1
=
ssl
.
sslsocket
(
s1
,
ssl_version
=
ssl
.
PROTOCOL_TLSv1
)
c1
=
ssl
.
sslsocket
(
s1
,
ssl_version
=
ssl
.
PROTOCOL_TLSv1
)
except
:
except
:
sys
.
stdout
.
write
(
"SSL handshake failure:
\n
"
+
string
.
join
(
sys
.
stdout
.
write
(
"SSL handshake failure:
\n
"
+
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
raise
test_support
.
TestFailed
(
"Can't SSL-handshake with test server"
)
raise
test_support
.
TestFailed
(
"Can't SSL-handshake with test server"
)
else
:
else
:
...
@@ -120,7 +119,7 @@ class ConnectedTests(unittest.TestCase):
...
@@ -120,7 +119,7 @@ class ConnectedTests(unittest.TestCase):
try
:
try
:
s2
.
connect
((
'127.0.0.1'
,
10024
))
s2
.
connect
((
'127.0.0.1'
,
10024
))
except
:
except
:
sys
.
stdout
.
write
(
"connection failure:
\n
"
+
string
.
join
(
sys
.
stdout
.
write
(
"connection failure:
\n
"
+
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
raise
test_support
.
TestFailed
(
"Can't connect to test server"
)
raise
test_support
.
TestFailed
(
"Can't connect to test server"
)
else
:
else
:
...
@@ -128,7 +127,7 @@ class ConnectedTests(unittest.TestCase):
...
@@ -128,7 +127,7 @@ class ConnectedTests(unittest.TestCase):
c2
=
ssl
.
sslsocket
(
s2
,
ssl_version
=
ssl
.
PROTOCOL_TLSv1
,
c2
=
ssl
.
sslsocket
(
s2
,
ssl_version
=
ssl
.
PROTOCOL_TLSv1
,
cert_reqs
=
ssl
.
CERT_REQUIRED
,
ca_certs
=
CERTFILE
)
cert_reqs
=
ssl
.
CERT_REQUIRED
,
ca_certs
=
CERTFILE
)
except
:
except
:
sys
.
stdout
.
write
(
"SSL handshake failure:
\n
"
+
string
.
join
(
sys
.
stdout
.
write
(
"SSL handshake failure:
\n
"
+
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
raise
test_support
.
TestFailed
(
"Can't SSL-handshake with test server"
)
raise
test_support
.
TestFailed
(
"Can't SSL-handshake with test server"
)
else
:
else
:
...
@@ -174,7 +173,7 @@ class ThreadedEchoServer(threading.Thread):
...
@@ -174,7 +173,7 @@ class ThreadedEchoServer(threading.Thread):
except
:
except
:
# here, we want to stop the server, because this shouldn't
# here, we want to stop the server, because this shouldn't
# happen in the context of our test case
# happen in the context of our test case
sys
.
stdout
.
write
(
"Test server failure:
\n
"
+
string
.
join
(
sys
.
stdout
.
write
(
"Test server failure:
\n
"
+
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
self
.
running
=
False
self
.
running
=
False
# normally, we'd just stop here, but for the test
# normally, we'd just stop here, but for the test
...
@@ -197,7 +196,7 @@ class ThreadedEchoServer(threading.Thread):
...
@@ -197,7 +196,7 @@ class ThreadedEchoServer(threading.Thread):
#sys.stdout.write("\nserver: %s\n" % msg.strip().lower())
#sys.stdout.write("\nserver: %s\n" % msg.strip().lower())
sslconn
.
write
(
msg
.
lower
())
sslconn
.
write
(
msg
.
lower
())
except
ssl
.
sslerror
:
except
ssl
.
sslerror
:
sys
.
stdout
.
write
(
"Test server failure:
\n
"
+
string
.
join
(
sys
.
stdout
.
write
(
"Test server failure:
\n
"
+
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
sslconn
.
close
()
sslconn
.
close
()
self
.
running
=
False
self
.
running
=
False
...
@@ -205,7 +204,7 @@ class ThreadedEchoServer(threading.Thread):
...
@@ -205,7 +204,7 @@ class ThreadedEchoServer(threading.Thread):
# harness, we want to stop the server
# harness, we want to stop the server
self
.
server
.
stop
()
self
.
server
.
stop
()
except
:
except
:
sys
.
stdout
.
write
(
string
.
join
(
sys
.
stdout
.
write
(
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
def
__init__
(
self
,
port
,
certificate
,
ssl_version
=
None
,
def
__init__
(
self
,
port
,
certificate
,
ssl_version
=
None
,
...
@@ -251,7 +250,7 @@ class ThreadedEchoServer(threading.Thread):
...
@@ -251,7 +250,7 @@ class ThreadedEchoServer(threading.Thread):
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
self
.
stop
()
self
.
stop
()
except
:
except
:
sys
.
stdout
.
write
(
"Test server failure:
\n
"
+
string
.
join
(
sys
.
stdout
.
write
(
"Test server failure:
\n
"
+
' '
.
join
(
traceback
.
format_exception
(
*
sys
.
exc_info
())))
traceback
.
format_exception
(
*
sys
.
exc_info
())))
def
stop
(
self
):
def
stop
(
self
):
...
@@ -322,7 +321,8 @@ def create_cert_files():
...
@@ -322,7 +321,8 @@ def create_cert_files():
(
conffile
,
crtfile
,
crtfile
))
(
conffile
,
crtfile
,
crtfile
))
# now we have a self-signed server cert in crtfile
# now we have a self-signed server cert in crtfile
os
.
unlink
(
conffile
)
os
.
unlink
(
conffile
)
if
error
or
not
os
.
path
.
exists
(
crtfile
)
or
os
.
path
.
getsize
(
crtfile
)
==
0
:
if
(
os
.
WEXITSTATUS
(
error
)
or
not
os
.
path
.
exists
(
crtfile
)
or
os
.
path
.
getsize
(
crtfile
)
==
0
):
raise
test_support
.
TestFailed
(
raise
test_support
.
TestFailed
(
"Unable to create certificate for test
%
d."
%
error
)
"Unable to create certificate for test
%
d."
%
error
)
return
d
,
crtfile
return
d
,
crtfile
...
...
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