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
62e3ffed
Commit
62e3ffed
authored
Nov 12, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the non-standard wsgi.input_terminated flag. Fixes #1308.
parent
b74209a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
10 deletions
+21
-10
CHANGES.rst
CHANGES.rst
+3
-0
src/gevent/pywsgi.py
src/gevent/pywsgi.py
+4
-0
src/gevent/tests/test__pywsgi.py
src/gevent/tests/test__pywsgi.py
+11
-8
src/gevent/tests/test__socket_dns.py
src/gevent/tests/test__socket_dns.py
+3
-2
No files found.
CHANGES.rst
View file @
62e3ffed
...
...
@@ -50,6 +50,9 @@
enums instead of plain integers for the socket type and address
family on Python 3. See :issue:`1310` reported by TheYOSH.
- Make gevent's pywsgi server set the non-standard environment value
``wsgi.input_terminated`` to True. See :issue:`1308`.
1.3.7 (2018-10-12)
==================
...
...
src/gevent/pywsgi.py
View file @
62e3ffed
...
...
@@ -1119,6 +1119,10 @@ class WSGIHandler(object):
chunked
=
env
.
get
(
'HTTP_TRANSFER_ENCODING'
,
''
).
lower
()
==
'chunked'
self
.
wsgi_input
=
Input
(
self
.
rfile
,
self
.
content_length
,
socket
=
sock
,
chunked_input
=
chunked
)
env
[
'wsgi.input'
]
=
self
.
wsgi_input
# This is a non-standard flag indicating that our input stream is
# self-terminated (returns EOF when consumed).
# See https://github.com/gevent/gevent/issues/1308
env
[
'wsgi.input_terminated'
]
=
True
return
env
...
...
src/gevent/tests/test__pywsgi.py
View file @
62e3ffed
...
...
@@ -371,8 +371,8 @@ class TestNoChunks(CommonTests):
# it calculates the content-length and joins all the chunks before sending
validator
=
None
@
staticmethod
def
application
(
env
,
start_response
):
def
application
(
self
,
env
,
start_response
):
self
.
assertTrue
(
env
.
get
(
'wsgi.input_terminated'
))
path
=
env
[
'PATH_INFO'
]
if
path
==
'/'
:
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)])
...
...
@@ -400,8 +400,8 @@ class TestExplicitContentLength(TestNoChunks): # pylint:disable=too-many-ancesto
# when returning a list of strings a shortcut is empoyed by the
# server - it caculates the content-length
@
staticmethod
def
application
(
env
,
start_response
):
def
application
(
self
,
env
,
start_response
):
self
.
assertTrue
(
env
.
get
(
'wsgi.input_terminated'
))
path
=
env
[
'PATH_INFO'
]
if
path
==
'/'
:
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
),
(
'Content-Length'
,
'11'
)])
...
...
@@ -520,6 +520,7 @@ class TestChunkedApp(TestCase):
return
b''
.
join
(
self
.
chunks
)
def
application
(
self
,
env
,
start_response
):
self
.
assertTrue
(
env
.
get
(
'wsgi.input_terminated'
))
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)])
for
chunk
in
self
.
chunks
:
yield
chunk
...
...
@@ -552,8 +553,9 @@ class TestBigChunks(TestChunkedApp):
class
TestNegativeRead
(
TestCase
):
@
staticmethod
def
application
(
env
,
start_response
):
def
application
(
self
,
env
,
start_response
):
self
.
assertTrue
(
env
.
get
(
'wsgi.input_terminated'
))
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)])
if
env
[
'PATH_INFO'
]
==
'/read'
:
data
=
env
[
'wsgi.input'
].
read
(
-
1
)
...
...
@@ -605,8 +607,9 @@ class TestNegativeReadline(TestCase):
class
TestChunkedPost
(
TestCase
):
@
staticmethod
def
application
(
env
,
start_response
):
def
application
(
self
,
env
,
start_response
):
self
.
assertTrue
(
env
.
get
(
'wsgi.input_terminated'
))
start_response
(
'200 OK'
,
[(
'Content-Type'
,
'text/plain'
)])
if
env
[
'PATH_INFO'
]
==
'/a'
:
data
=
env
[
'wsgi.input'
].
read
(
6
)
...
...
src/gevent/tests/test__socket_dns.py
View file @
62e3ffed
...
...
@@ -412,7 +412,8 @@ add(Test1234, '1.2.3.4')
class
Test127001
(
TestCase
):
pass
add
(
Test127001
,
'127.0.0.1'
,
add
(
Test127001
,
'127.0.0.1'
,
skip
=
greentest
.
RUNNING_ON_TRAVIS
,
skip_reason
=
"Beginning Dec 1 2017, ares started returning ip6-localhost "
"instead of localhost"
...
...
@@ -621,7 +622,7 @@ class TestInterrupted_gethostbyname(gevent.testing.timing.AbstractGenericWaitTes
# gaierror: [Errno -2] Name or service not known
try
:
gevent
.
get_hub
().
threadpool
.
join
()
except
Exception
:
# p
ylint:disable=broad-except pragma: no cover
except
Exception
:
# p
ragma: no cover pylint:disable=broad-except
traceback
.
print_exc
()
...
...
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