Author: russellm Date: 2010-11-02 02:38:06 -0500 (Tue, 02 Nov 2010) New Revision: 14435
Modified: django/trunk/django/http/__init__.py Log: Fixed #14594 -- Corrected a problem introduced by r14394 whereby reading POST data when running a WSGI server under CherryPy would hang. Thanks to Mark Sundstrom for the report. Modified: django/trunk/django/http/__init__.py =================================================================== --- django/trunk/django/http/__init__.py 2010-11-02 05:55:08 UTC (rev 14434) +++ django/trunk/django/http/__init__.py 2010-11-02 07:38:06 UTC (rev 14435) @@ -140,7 +140,17 @@ if not hasattr(self, '_raw_post_data'): if self._read_started: raise Exception("You cannot access raw_post_data after reading from request's data stream") - self._raw_post_data = self.read() + try: + content_length = int(self.META.get('CONTENT_LENGTH', 0)) + except (ValueError, TypeError): + # If CONTENT_LENGTH was empty string or not an integer, don't + # error out. We've also seen None passed in here (against all + # specs, but see ticket #8259), so we handle TypeError as well. + content_length = 0 + if content_length: + self._raw_post_data = self.read() + else: + self._raw_post_data = self.read(int(content_length)) self._stream = StringIO(self._raw_post_data) return self._raw_post_data raw_post_data = property(_get_raw_post_data) -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.