Ticket #8259: patch.diff

File patch.diff, 863 bytes (added by Kevin McConnell, 16 years ago)

Treat Content-Length of None as if empty string

  • django/core/handlers/wsgi.py

     
    173173            try:
    174174                # CONTENT_LENGTH might be absent if POST doesn't have content at all (lighttpd)
    175175                content_length = int(self.environ.get('CONTENT_LENGTH', 0))
    176             except ValueError: # if CONTENT_LENGTH was empty string or not an integer
     176            except (ValueError, TypeError):
     177                # If CONTENT_LENGTH was empty string, None or not an integer.
     178                # It ought not to be None, but that has been reported (see #8259) hence TypeError.
    177179                content_length = 0
    178180            if content_length > 0:
    179181                safe_copyfileobj(self.environ['wsgi.input'], buf,
Back to Top