Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
39295c26
Commit
39295c26
authored
Aug 12, 2008
by
Bill Janssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove duplicate close() from ssl.py; expose unwrap and add test for it
parent
f91d46a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
Lib/ssl.py
Lib/ssl.py
+8
-4
Lib/test/test_ssl.py
Lib/test/test_ssl.py
+17
-2
No files found.
Lib/ssl.py
View file @
39295c26
...
...
@@ -234,14 +234,18 @@ class SSLSocket (socket):
else
:
return
0
def
unwrap
(
self
):
if
self
.
_sslobj
:
s
=
self
.
_sslobj
.
shutdown
()
self
.
_sslobj
=
None
return
s
else
:
raise
ValueError
(
"No SSL wrapper around "
+
str
(
self
))
def
shutdown
(
self
,
how
):
self
.
_sslobj
=
None
socket
.
shutdown
(
self
,
how
)
def
close
(
self
):
self
.
_sslobj
=
None
socket
.
close
(
self
)
def
close
(
self
):
if
self
.
_makefile_refs
<
1
:
self
.
_sslobj
=
None
...
...
Lib/test/test_ssl.py
View file @
39295c26
...
...
@@ -282,6 +282,14 @@ else:
self
.
write
(
"OK
\
n
"
)
if
not
self
.
wrap_conn
():
return
elif
self
.
server
.
starttls_server
and
self
.
sslconn
and
msg
.
strip
()
==
'ENDTLS'
:
if
test_support
.
verbose
and
self
.
server
.
connectionchatty
:
sys
.
stdout
.
write
(
" server: read ENDTLS from client, sending OK...
\
n
"
)
self
.
write
(
"OK
\
n
"
)
self
.
sslconn
.
unwrap
()
self
.
sslconn
=
None
if
test_support
.
verbose
and
self
.
server
.
connectionchatty
:
sys
.
stdout
.
write
(
" server: connection is now unencrypted...
\
n
"
)
else
:
if
(
test_support
.
verbose
and
self
.
server
.
connectionchatty
):
...
...
@@ -867,7 +875,7 @@ else:
def
testSTARTTLS
(
self
):
msgs
=
(
"msg 1"
,
"MSG 2"
,
"STARTTLS"
,
"MSG 3"
,
"msg 4"
)
msgs
=
(
"msg 1"
,
"MSG 2"
,
"STARTTLS"
,
"MSG 3"
,
"msg 4"
,
"ENDTLS"
,
"msg 5"
,
"msg 6"
)
server
=
ThreadedEchoServer
(
CERTFILE
,
ssl_version
=
ssl
.
PROTOCOL_TLSv1
,
...
...
@@ -907,8 +915,15 @@ else:
" client: read %s from server, starting TLS...
\
n
"
%
repr
(
outdata
))
conn
=
ssl
.
wrap_socket
(
s
,
ssl_version
=
ssl
.
PROTOCOL_TLSv1
)
wrapped
=
True
elif
(
indata
==
"ENDTLS"
and
outdata
.
strip
().
lower
().
startswith
(
"ok"
)):
if
test_support
.
verbose
:
sys
.
stdout
.
write
(
" client: read %s from server, ending TLS...
\
n
"
%
repr
(
outdata
))
s
=
conn
.
unwrap
()
wrapped
=
False
else
:
if
test_support
.
verbose
:
sys
.
stdout
.
write
(
...
...
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