Ticket #5611: modpython.diff

File modpython.diff, 1.6 KB (added by Paul Egan, 16 years ago)

Patch to check content-type before parsing post body - updated to r9747

  • django/core/handlers/modpython.py

     
    7676            return self._req.subprocess_env.get('HTTPS', '').lower() in ('on', '1')
    7777
    7878    def _load_post_and_files(self):
    79         "Populates self._post and self._files"
     79        "Populates self._post and self._files if the content-type is a form type"
    8080        if self.method != 'POST':
    8181            self._post, self._files = http.QueryDict('', encoding=self._encoding), datastructures.MultiValueDict()
    8282            return
    8383
    84         if 'content-type' in self._req.headers_in and self._req.headers_in['content-type'].startswith('multipart'):
     84        if self._req.headers_in.get('content-type','').startswith('multipart/form-data'):
    8585            self._raw_post_data = ''
    8686            try:
    8787                self._post, self._files = self.parse_file_upload(self.META, self._req)
     
    9292                self._files = datastructures.MultiValueDict()
    9393                self._post_parse_error = True
    9494                raise
     95        elif self._req.headers_in.get('content-type','').startswith('application/x-www-form-urlencoded'):
     96            self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()
    9597        else:
    96             self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict()
     98            self._post, self._files = http.QueryDict(''), datastructures.MultiValueDict()
    9799
    98100    def _get_request(self):
    99101        if not hasattr(self, '_request'):
Back to Top