MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/core/servers/basehttp.py:118–131  ·  view source on GitHub ↗

Use a LimitedStream so that unread request data will be ignored at the end of the request. WSGIRequest uses a LimitedStream but it shouldn't discard the data since the upstream servers usually do this. This fix applies only for testserver/runserver.

(self, stdin, stdout, stderr, environ, **kwargs)

Source from the content-addressed store, hash-verified

116 http_version = "1.1"
117
118 def __init__(self, stdin, stdout, stderr, environ, **kwargs):
119 """
120 Use a LimitedStream so that unread request data will be ignored at
121 the end of the request. WSGIRequest uses a LimitedStream but it
122 shouldn't discard the data since the upstream servers usually do this.
123 This fix applies only for testserver/runserver.
124 """
125 try:
126 content_length = int(environ.get("CONTENT_LENGTH"))
127 except (ValueError, TypeError):
128 content_length = 0
129 super().__init__(
130 LimitedStream(stdin, content_length), stdout, stderr, environ, **kwargs
131 )
132
133 def cleanup_headers(self):
134 super().cleanup_headers()

Callers

nothing calls this directly

Calls 3

LimitedStreamClass · 0.90
getMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected