Exemplo n.º 1
0
 def _get_get(self):
     try:
         return self._get
     except AttributeError:
         # The WSGI spec says 'QUERY_STRING' may be absent.
         self._get = urlparse.queryparse(self.environ.get(b'QUERY_STRING', b''))
         return self._get
Exemplo n.º 2
0
 def _get_get(self):
     try:
         return self._get
     except AttributeError:
         # The WSGI spec says 'QUERY_STRING' may be absent.
         self._get = urlparse.queryparse(
             self.environ.get(b'QUERY_STRING', b''))
         return self._get
Exemplo n.º 3
0
 def _parse_post_content(self):
     if self.method == b'POST':
         content_type = httputils.ContentType(self.environ.get(b'CONTENT_TYPE', ''))
         ctvalue = content_type.value.lower()
         if ctvalue == b'multipart/form-data':
             self._post, self._files = parse_formdata(content_type, self._get_raw_post_data())
         elif ctvalue == b"application/x-www-form-urlencoded":
             self._post = urlparse.queryparse(self._get_raw_post_data())
             self._files = None
         else: # some buggy clients don't set proper content-type, so
               # just preserve the raw data as a file.
             self.log_error("Bad content-type: {!s}".format(content_type))
             data = self._get_raw_post_data()
             self._post = urlparse.queryparse(data)
             self._files = {}
             self._files["body"] = {
                 b'content-type': content_type,
                 b'content': data,
             }
     else:
         self._post = urlparse.URLQuery()
         self._files = None
Exemplo n.º 4
0
 def _load_post_and_files(self):
     # Populates self._post and self._files
     if self.method == 'POST':
         if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
             header_dict = dict([(k, v) for k, v in self.environ.items() if k.startswith('HTTP_')])
             header_dict['Content-Type'] = self.environ.get('CONTENT_TYPE', '')
             self._post, self._files = parse_file_upload(header_dict, self.raw_post_data)
         else:
             self._post = urlparse.queryparse(self.raw_post_data)
             self._files = urlparse.URLQuery()
     else:
         self._post = urlparse.URLQuery()
         self._post = urlparse.URLQuery()
Exemplo n.º 5
0
 def _parse_post_content(self):
     if self.method == b'POST':
         content_type = httputils.ContentType(
             self.environ.get(b'CONTENT_TYPE', ''))
         ctvalue = content_type.value.lower()
         if ctvalue == b'multipart/form-data':
             self._post, self._files = parse_formdata(
                 content_type, self._get_raw_post_data())
         elif ctvalue == b"application/x-www-form-urlencoded":
             self._post = urlparse.queryparse(self._get_raw_post_data())
             self._files = None
         else:  # some buggy clients don't set proper content-type, so
             # just preserve the raw data as a file.
             self.log_error("Bad content-type: {!s}".format(content_type))
             data = self._get_raw_post_data()
             self._post = urlparse.queryparse(data)
             self._files = {}
             self._files["body"] = {
                 b'content-type': content_type,
                 b'content': data,
             }
     else:
         self._post = urlparse.URLQuery()
         self._files = None
Exemplo n.º 6
0
 def _load_post_and_files(self):
     # Populates self._post and self._files
     if self.method == 'POST':
         if self.environ.get('CONTENT_TYPE', '').startswith('multipart'):
             header_dict = dict([(k, v) for k, v in self.environ.items()
                                 if k.startswith('HTTP_')])
             header_dict['Content-Type'] = self.environ.get(
                 'CONTENT_TYPE', '')
             self._post, self._files = parse_file_upload(
                 header_dict, self.raw_post_data)
         else:
             self._post = urlparse.queryparse(self.raw_post_data)
             self._files = urlparse.URLQuery()
     else:
         self._post = urlparse.URLQuery()
         self._post = urlparse.URLQuery()