Skip to content

Commit

Permalink
Support wsgi.input_terminated
Browse files Browse the repository at this point in the history
This has grown support in uWSGI and we would like to support it as well.

Closes #278
  • Loading branch information
digitalresistor committed Nov 20, 2017
1 parent 6cf9452 commit 2e20d7c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions webob/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,14 +902,25 @@ def is_body_readable(self):
if clen is not None and clen != 0:
return True
elif clen is None:
# rely on the special flag
return self.environ.get('webob.is_body_readable', False)
# Rely on the special flag that signifies that either Chunked
# Encoding is allowed (and works) or we have replaced
# self.body_file with something that is readable and EOF's
# correctly.
return self.environ.get(
'wsgi.input_terminated',
# For backwards compatibility, we fall back to checking if
# webob.is_body_readable is set in the environ
self.environ.get(
'webob.is_body_readable',
False
)
)

return False

@is_body_readable.setter
def is_body_readable(self, flag):
self.environ['webob.is_body_readable'] = bool(flag)
self.environ['wsgi.input_terminated'] = bool(flag)

def make_body_seekable(self):
"""
Expand Down

0 comments on commit 2e20d7c

Please sign in to comment.