Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
5a8899ae
Commit
5a8899ae
authored
Dec 08, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the pywsgi SSLContext tests on Python 2.7
Don't define them on 2.7.8. Add a changelog entry. Fixes #904
parent
4bead9db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
changelog.rst
changelog.rst
+2
-0
src/greentest/test__pywsgi.py
src/greentest/test__pywsgi.py
+23
-9
No files found.
changelog.rst
View file @
5a8899ae
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
on non-Windows systems for ease of development on BSD systems where
on non-Windows systems for ease of development on BSD systems where
``make`` is BSD make and ``gmake`` is GNU make (gevent requires GNU
``make`` is BSD make and ``gmake`` is GNU make (gevent requires GNU
make). See :issue:`888`.
make). See :issue:`888`.
- Let :class:`gevent.server.StreamServer` accept an ``SSLContext`` on
Python versions that support it. Added in :pr:`904` by Arcadiy Ivanov.
1.2a1 (Oct 27, 2016)
1.2a1 (Oct 27, 2016)
====================
====================
...
...
src/greentest/test__pywsgi.py
View file @
5a8899ae
...
@@ -741,13 +741,26 @@ class HttpsTestCase(TestCase):
...
@@ -741,13 +741,26 @@ class HttpsTestCase(TestCase):
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)])
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)])
return
[
environ
[
'wsgi.input'
].
read
(
10
)]
return
[
environ
[
'wsgi.input'
].
read
(
10
)]
try
:
class
HttpsSslContextTestCase
(
HttpsTestCase
):
from
ssl
import
create_default_context
as
_
def
init_server
(
self
,
application
):
except
ImportError
:
from
ssl
import
create_default_context
HAVE_SSLCONTEXT
=
False
context
=
create_default_context
()
else
:
context
.
load_cert_chain
(
certfile
=
self
.
certfile
,
keyfile
=
self
.
keyfile
)
HAVE_SSLCONTEXT
=
True
self
.
server
=
pywsgi
.
WSGIServer
((
'127.0.0.1'
,
0
),
application
,
ssl_context
=
context
)
class
HttpsSslContextTestCase
(
HttpsTestCase
):
def
init_server
(
self
,
application
):
# On 2.7, our certs don't line up with hostname.
# If we just use create_default_context as-is, we get
# `ValueError: check_hostname requires server_hostname`.
# If we set check_hostname to False, we get
# `SSLError: [SSL: PEER_DID_NOT_RETURN_A_CERTIFICATE] peer did not return a certificate`
# (Neither of which happens in Python 3.) But the unverified context
# works both places. See also test___example_servers.py
from
ssl
import
_create_unverified_context
context
=
_create_unverified_context
()
context
.
load_cert_chain
(
certfile
=
self
.
certfile
,
keyfile
=
self
.
keyfile
)
self
.
server
=
pywsgi
.
WSGIServer
((
'127.0.0.1'
,
0
),
application
,
ssl_context
=
context
)
class
TestHttps
(
HttpsTestCase
):
class
TestHttps
(
HttpsTestCase
):
...
@@ -761,8 +774,9 @@ class TestHttps(HttpsTestCase):
...
@@ -761,8 +774,9 @@ class TestHttps(HttpsTestCase):
result
=
self
.
urlopen
()
result
=
self
.
urlopen
()
self
.
assertEquals
(
result
.
body
,
''
)
self
.
assertEquals
(
result
.
body
,
''
)
class
TestHttpsWithContext
(
HttpsSslContextTestCase
,
TestHttps
):
if
HAVE_SSLCONTEXT
:
pass
class
TestHttpsWithContext
(
HttpsSslContextTestCase
,
TestHttps
):
pass
class
TestInternational
(
TestCase
):
class
TestInternational
(
TestCase
):
validator
=
None
# wsgiref.validate.IteratorWrapper([]) does not have __len__
validator
=
None
# wsgiref.validate.IteratorWrapper([]) does not have __len__
...
...
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