Opened 15 years ago
Closed 15 years ago
#14061 closed (duplicate)
MultiPartParser receives an HTTP_CONTENT_LENGTH of zero
| Reported by: | echamberlain | Owned by: | nobody |
|---|---|---|---|
| Component: | File uploads/storage | Version: | 1.2 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
We have an intermittent problem when uploading files. About one in five uploads fails, when the MultiPartParser receives an HTTP_CONTENT_LENGTH of zero.
Is anyone else seeing this issue?
We are running Django 1.2.1 with lighttpd 1.4.19 using fastcgi with flup flup-1.0.3.dev_20100525.
Traceback (most recent call last):
File "/home/django/projects/talk/lib/python2.6/site-packages/django/core/handlers/base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/home/django/projects/talk/lib/python2.6/site-packages/django/views/decorators/vary.py", line 22, in inner_func
response = func(*args, **kwargs)
File "/home/django/projects/talk/lib/python2.6/site-packages/django_piston-0.2.3rc1-py2.6.egg/piston/resource.py", line 142, in __call__
request.data = request.POST
File "/home/django/projects/talk/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 171, in _get_post
self._load_post_and_files()
File "/home/django/projects/talk/lib/python2.6/site-packages/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 "/home/django/projects/talk/lib/python2.6/site-packages/django/http/__init__.py", line 123, in parse_file_upload
parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding)
File "/home/django/projects/talk/lib/python2.6/site-packages/django/http/multipartparser.py", line 80, in __init__
raise MultiPartParserError("Invalid content length: %r" % content_length)
MultiPartParserError: Invalid content length: 0
<WSGIRequest
GET:<QueryDict: {}>,
POST:<could not parse>,
COOKIES:{},
META:{'CONTENT_TYPE': 'multipart/form-data; charset=utf-8; boundary=0xKhTmLbOuNdArY',
'DOCUMENT_ROOT': '/home/django/projects/talk',
'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTPS': 'on',
'HTTP_ACCEPT_ENCODING': 'gzip',
'HTTP_AUTHORIZATION': 'Basic ************',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_CONTENT_LENGTH': '0',
'HTTP_HOST': 'talk-dev.rf.com',
'HTTP_USER_AGENT': 'RF.com 1.0 (iPhone Simulator; iPhone OS 4.0.1; en_US)',
'PATH_INFO': u'/message/',
'PATH_TRANSLATED': '/home/django/projects/talk/message/',
'QUERY_STRING': '',
'REDIRECT_STATUS': '200',
'REDIRECT_URI': '/mysite.fcgi/message/',
'REMOTE_ADDR': '67.188.41.104',
'REMOTE_PORT': '35608',
'REQUEST_METHOD': 'POST',
'REQUEST_URI': '/message/',
'SCRIPT_FILENAME': '/home/django/projects/talk/mysite.fcgi',
'SCRIPT_NAME': u'',
'SERVER_ADDR': '10.254.105.188',
'SERVER_NAME': 'dev.rf.com',
'SERVER_PORT': '443',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'lighttpd/1.4.19',
'wsgi.errors': <flup.server.fcgi_base.TeeOutputStream object at 0x8c7f1cc>,
'wsgi.input': <flup.server.fcgi_base.InputStream object at 0x8c7fe2c>,
'wsgi.multiprocess': False,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'https',
'wsgi.version': (1, 0)}>
Note:
See TracTickets
for help on using tickets.
Searching Trac for MultiPartParser reveals #12411, which was ultimately determined to be not a Django bug. So my first inclination would be to check for problems in whatever boxes are sitting between the client and the Django server.