Opened 8 years ago

Closed 8 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: UI/UX:


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/", 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/", 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/", line 142, in __call__ = request.POST

 File "/home/django/projects/talk/lib/python2.6/site-packages/django/core/handlers/", line 171, in _get_post

 File "/home/django/projects/talk/lib/python2.6/site-packages/django/core/handlers/", 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/", 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/", line 80, in __init__
   raise MultiPartParserError("Invalid content length: %r" % content_length)

MultiPartParserError: Invalid content length: 0

GET:<QueryDict: {}>,
POST:<could not parse>,
META:{'CONTENT_TYPE': 'multipart/form-data; charset=utf-8; boundary=0xKhTmLbOuNdArY',
'DOCUMENT_ROOT': '/home/django/projects/talk',
'HTTPS': 'on',
'HTTP_AUTHORIZATION': 'Basic ************',
'HTTP_CONNECTION': 'keep-alive',
'HTTP_HOST': '',
'HTTP_USER_AGENT': ' 1.0 (iPhone Simulator; iPhone OS 4.0.1; en_US)',
'PATH_INFO': u'/message/',
'PATH_TRANSLATED': '/home/django/projects/talk/message/',
'REDIRECT_URI': '/mysite.fcgi/message/',
'REMOTE_PORT': '35608',
'REQUEST_URI': '/message/',
'SCRIPT_FILENAME': '/home/django/projects/talk/mysite.fcgi',
'SERVER_PORT': '443',
'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)}>

Change History (1)

comment:1 Changed 8 years ago by Karen Tracey

Resolution: duplicate
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top