Ticket #3496: wsgi_patch2.diff
File wsgi_patch2.diff, 1.2 KB (added by , 18 years ago) |
---|
-
django/core/handlers/wsgi.py
160 160 try: 161 161 # CONTENT_LENGTH might be absent if POST doesn't have content at all (lighttpd) 162 162 content_length = int(self.environ.get('CONTENT_LENGTH', 0)) 163 has_content_length = True 163 164 except ValueError: # if CONTENT_LENGTH was empty string or not an integer 164 165 content_length = 0 165 safe_copyfileobj(self.environ['wsgi.input'], buf, size=content_length) 166 self._raw_post_data = buf.getvalue() 166 has_content_length = False 167 168 if has_content_length and content_length == 0: 169 # Empty HTML forms do post a content length, but with a length of 0. 170 # Socket read doesn't return with a size of 0. See #3496. 171 pass 172 else: 173 safe_copyfileobj(self.environ['wsgi.input'], buf, size=content_length) 174 175 self._raw_post_data = buf.getvalue() 167 176 buf.close() 168 177 return self._raw_post_data 169 178