#10046: ModPythonHandler class should check for IOError when writing response
---------------------------------------------+------------------------------
Reporter: ewoudenberg | Owner: nobody
Status: new | Milestone:
Component: HTTP handling | Version: 1.1
Resolution: | Keywords:
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by edevil):
I also get these errors dozens of times per day. The problem lies not only
when writing the response but when requesting POST parameters on a POST
multipart request. If the request is not complete or the response cannot
be written django should have an option to continue silently. Here is an
example traceback from the CSRF middleware:
{{{
Traceback (most recent call last):
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/core/handlers/base.py", line 95, in
get_response
response = middleware_method(request, callback, callback_args,
callback_kwargs)
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/middleware/csrf.py", line 158, in
process_view
request_csrf_token = request.POST.get('csrfmiddlewaretoken', None)
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/core/handlers/wsgi.py", line 171,
in _get_post
self._load_post_and_files()
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/core/handlers/wsgi.py", line 137,
in _load_post_and_files
self._post, self._files = self.parse_file_upload(self.META,
self.environ['wsgi.input'])
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/http/__init__.py", line 124, in
parse_file_upload
return parser.parse()
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/http/multipartparser.py", line 192,
in parse
for chunk in field_stream:
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/http/multipartparser.py", line 314,
in next
output = self._producer.next()
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/http/multipartparser.py", line 468,
in next
for bytes in stream:
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/http/multipartparser.py", line 314,
in next
output = self._producer.next()
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/http/multipartparser.py", line 375,
in next
data = self.flo.read(self.chunk_size)
File "/servers/python-2.6/lib/python2.6/site-
packages/Django-1.2.1-py2.6.egg/django/http/multipartparser.py", line 405,
in read
return self._file.read(num_bytes)
IOError: request data read error
<WSGIRequest
GET:<QueryDict: {}>,
POST:<could not parse>,
COOKIES:{'_shibsession_49445349642e7361706f2e7074': '_f0',
'_swa_uv': '3346690041278958258',
'_swa_v': '4056487021281436498',
'csrftoken': 'abe42a7836f8c63796897ba2b487982c',
'sessionid': '7aef0bea88'},
META:{'AUTH_TYPE': 'shibboleth',
'CONTENT_LENGTH': '694660',
'CONTENT_TYPE': 'multipart/form-data;
boundary=----WebKitFormBoundarysimXQBqzPfkcD9Mq',
'CSRF_COOKIE': 'abe42a7836f8c63796897ba2b487982c',
'DOCUMENT_ROOT': '/servers/profiles',
'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTPS': '1',
'HTTP_ACCEPT':
'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
'HTTP_ACCEPT_LANGUAGE': 'pt-PT,pt;q=0.8,en-US;q=0.6,en;q=0.4',
'HTTP_CACHE_CONTROL': 'max-age=0',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_HOST': 'id.sapo.pt',
'HTTP_SHIB_APPLICATION_ID': 'IDSAPO',
'HTTP_SHIB_ASSERTION_COUNT': '',
'HTTP_SHIB_AUTHENTICATION_INSTANT': '2010-08-10T10:57:19.911Z',
'HTTP_SHIB_AUTHENTICATION_METHOD':
'urn:oasis:names:tc:SAML:1.0:am:unspecified',
'HTTP_SHIB_AUTHNCONTEXT_CLASS':
'urn:oasis:names:tc:SAML:1.0:am:unspecified',
'HTTP_SHIB_AUTHNCONTEXT_DECL': '',
'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4',
'PATH_INFO': u'/a/upload_avatar',
'QUERY_STRING': '',
'REQUEST_METHOD': 'POST',
'REQUEST_URI': '/a/upload_avatar',
'SCRIPT_NAME': u'',
'SCRIPT_URI': 'https://id.sapo.pt/a/upload_avatar',
'SCRIPT_URL': '/a/upload_avatar',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SIGNATURE': '',
'SERVER_SOFTWARE': 'Apache',
'SSL_CIPHER': 'RC4-MD5',
'SSL_CIPHER_ALGKEYSIZE': '128',
'SSL_CIPHER_EXPORT': 'false',
'SSL_CIPHER_USEKEYSIZE': '128',
'SSL_CLIENT_VERIFY': 'NONE',
'SSL_COMPRESS_METHOD': 'NULL',
'SSL_PROTOCOL': 'TLSv1',
'SSL_SECURE_RENEG': 'false',
'SSL_SERVER_A_KEY': 'rsaEncryption',
'SSL_SERVER_A_SIG': 'sha1WithRSAEncryption',
'SSL_SERVER_M_SERIAL': '426C6EA4',
'SSL_SERVER_M_VERSION': '3',
'SSL_SERVER_S_DN': '/C=PT/O=MULTICERT-CA/OU=CERTIPOR -
RA/OU=Corporate/OU=PT Comunicacoes S.A./OU=Web Server/CN=id.sapo.pt',
'SSL_SERVER_S_DN_C': 'PT',
'SSL_SERVER_S_DN_CN': 'id.sapo.pt',
'SSL_SERVER_S_DN_O': 'MULTICERT-CA',
'SSL_SERVER_S_DN_OU': 'CERTIPOR - RA',
'SSL_SERVER_S_DN_OU_1': 'Corporate',
'SSL_SERVER_S_DN_OU_2': 'PT Comunicacoes S.A.',
'SSL_SERVER_S_DN_OU_3': 'Web Server',
'SSL_SERVER_V_END': 'Apr 22 16:34:31 2012 GMT',
'SSL_SERVER_V_START': 'Apr 22 16:33:03 2010 GMT',
'SSL_VERSION_INTERFACE': 'mod_ssl/2.2.16',
'mod_wsgi.application_group': 'id.sapo.pt|',
'mod_wsgi.callable_object': 'application',
'mod_wsgi.handler_script': '',
'mod_wsgi.input_chunked': '0',
'mod_wsgi.listener_host': '',
'mod_wsgi.listener_port': '443',
'mod_wsgi.process_group': '',
'mod_wsgi.request_handler': 'wsgi-script',
'mod_wsgi.script_reloading': '1',
'mod_wsgi.version': (3, 3),
'wsgi.errors': <mod_wsgi.Log object at 0x994e5fc0>,
'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter
object at 0x99431260>,
'wsgi.input': <mod_wsgi.Input object at 0x994e5e08>,
'wsgi.multiprocess': True,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'https',
'wsgi.version': (1, 1)}>
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/10046#comment:12>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.