MCPcopy
hub / github.com/benoitc/gunicorn / set_body_reader

Method set_body_reader

gunicorn/uwsgi/message.py:214–225  ·  view source on GitHub ↗

Set up the body reader based on CONTENT_LENGTH.

(self)

Source from the content-addressed store, hash-verified

212 self.headers.append(('CONTENT-LENGTH', value))
213
214 def set_body_reader(self):
215 """Set up the body reader based on CONTENT_LENGTH."""
216 content_length = 0
217
218 # Get content length from vars
219 if 'CONTENT_LENGTH' in self.uwsgi_vars:
220 try:
221 content_length = max(int(self.uwsgi_vars['CONTENT_LENGTH']), 0)
222 except ValueError:
223 content_length = 0
224
225 self.body = Body(LengthReader(self.unreader, content_length))
226
227 def should_close(self):
228 """Determine if the connection should be closed after this request."""

Callers 1

__init__Method · 0.95

Calls 2

BodyClass · 0.90
LengthReaderClass · 0.90

Tested by

no test coverage detected