Fixed #14602 -- Added an extra check to wsgi.input handling to prevent AppEngine from choking. Thanks to Waldemar Kornewald for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
05db03c206
commit
c906b270f5
|
@ -134,7 +134,7 @@ class WSGIRequest(http.HttpRequest):
|
||||||
self.META['SCRIPT_NAME'] = script_name
|
self.META['SCRIPT_NAME'] = script_name
|
||||||
self.method = environ['REQUEST_METHOD'].upper()
|
self.method = environ['REQUEST_METHOD'].upper()
|
||||||
self._post_parse_error = False
|
self._post_parse_error = False
|
||||||
if isinstance(self.environ['wsgi.input'], socket._fileobject):
|
if type(socket._fileobject) is type and isinstance(self.environ['wsgi.input'], socket._fileobject):
|
||||||
# Under development server 'wsgi.input' is an instance of
|
# Under development server 'wsgi.input' is an instance of
|
||||||
# socket._fileobject which hangs indefinitely on reading bytes past
|
# socket._fileobject which hangs indefinitely on reading bytes past
|
||||||
# available count. To prevent this it's wrapped in LimitedStream
|
# available count. To prevent this it's wrapped in LimitedStream
|
||||||
|
@ -144,6 +144,9 @@ class WSGIRequest(http.HttpRequest):
|
||||||
# streams) beacuse they don't suffer from this problem and we can
|
# streams) beacuse they don't suffer from this problem and we can
|
||||||
# avoid using another wrapper with its own .read and .readline
|
# avoid using another wrapper with its own .read and .readline
|
||||||
# implementation.
|
# implementation.
|
||||||
|
#
|
||||||
|
# The type check is done because for some reason, AppEngine
|
||||||
|
# implements _fileobject as a function, not a class.
|
||||||
try:
|
try:
|
||||||
content_length = int(self.environ.get('CONTENT_LENGTH', 0))
|
content_length = int(self.environ.get('CONTENT_LENGTH', 0))
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
|
|
Loading…
Reference in New Issue