Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#12411 closed (invalid)

MultiPartParserError: Invalid content length: 0

Reported by: alextreme Owned by: nobody
Component: Core (Other) Version: 1.1
Severity: Keywords: multipartparsererror
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi all,

Over the last few months I've been bumping in to seemingly-random MultiPartParserError's like the ones attached.

The project involved is for a client who likely are behind a proxy server that somehow mangles the POST requests to the django admin. The app itself isn't very exciting, the admin is used in-place and the model involved simply allows the user to upload files.

The environment is a Debian Lenny server with Django 1.1. I've tried various mod-wsgi and mod-python setups, I've attached a traceback for both.

I'll dive deeper into the bug over the next few days (and get some more details on the proxy used), but if anyone has any ideas I'd love to hear them.

A snippet from the traceback:

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", line 87, in _load_post_and_files
    self._post, self._files = self.parse_file_upload(self.META, self._req)

  File "/usr/lib/python2.5/site-packages/django/http/__init__.py", line 123, in parse_file_upload
    parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding)

  File "/usr/lib/python2.5/site-packages/django/http/multipartparser.py", line 80, in __init__
    raise MultiPartParserError("Invalid content length: %r" % content_length)

MultiPartParserError: Invalid content length: 0


<ModPythonRequest
path:/admin/<appname>/<modelname>/add/,
GET:<QueryDict: {}>,
POST:<could not parse>,
COOKIES:{'sessionid': 'e295f588b05ccf8d6ae7c6b05c8d9ac1'},

Attachments (2)

mod_python_mpp_error.txt (3.0 KB ) - added by alextreme 15 years ago.
mod_wsgi_mpp_error.txt (4.1 KB ) - added by alextreme 15 years ago.

Download all attachments as: .zip

Change History (4)

by alextreme, 15 years ago

Attachment: mod_python_mpp_error.txt added

by alextreme, 15 years ago

Attachment: mod_wsgi_mpp_error.txt added

comment:1 by Russell Keith-Magee, 15 years ago

Resolution: invalid
Status: newclosed

There isn't anywhere near enough detail here to reproduce the problem you describe, and digging into the problem "over the next few days" has turned into two months. Closing invalid; please reopen if you can confirm there is a real problem (preferably, check with django-users to confirm that there is a problem, and reopen the ticket if a flaw in Django is found).

comment:2 by alextreme, 15 years ago

Sorry, it took quite a bit of time to figure this one out. You were correct to close the bug, the fault wasn't Django's.

For anyone else coming across this issue, in my case it occurred due to a Microsoft ISA Server 2006 proxy server. I still don't know the exact configuration details of this server, but it cut off random POST requests from clients accessing my Django application which caused the above error.

The 'solution' was to switch to HTTPS, after a week of testing not a single error occurred.

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