Esempio n. 1
0
	def _parse_post(self):

		# error check and gather required env variables
		try:
			length = long(self.env["CONTENT_LENGTH"])
		except KeyError:
			raise FormInputClientError(
				"POST request without a CONTENT_LENGTH header.")
		except ValueError:
			raise FormInputClientError(
				"CONTENT_LENGTH header could not be converted to int.")
		try:
			content_type = self.env["CONTENT_TYPE"]
		except KeyError:
			raise FormInputClientError(
				"POST request without a CONTENT_TYPE header")


		# check the content-type and parse body accordingly
		if content_type == "application/x-www-form-urlencoded":
			body = self.env["wsgi.input"].read(length)
			self.POST = parse_query_string(body, self.encoding)
		elif content_type.startswith("multipart/form-data"):
			self.files, self.POST = parse_multipart(content_type,
					length, self.env["wsgi.input"], self.encoding)
Esempio n. 2
0
    def _parse_post(self):

        # error check and gather required env variables
        try:
            length = long(self.env["CONTENT_LENGTH"])
        except KeyError:
            raise FormInputClientError(
                "POST request without a CONTENT_LENGTH header.")
        except ValueError:
            raise FormInputClientError(
                "CONTENT_LENGTH header could not be converted to int.")
        try:
            content_type = self.env["CONTENT_TYPE"]
        except KeyError:
            raise FormInputClientError(
                "POST request without a CONTENT_TYPE header")

        # check the content-type and parse body accordingly
        if content_type == "application/x-www-form-urlencoded":
            body = self.env["wsgi.input"].read(length)
            self.POST = parse_query_string(body, self.encoding)
        elif content_type.startswith("multipart/form-data"):
            self.files, self.POST = parse_multipart(content_type, length,
                                                    self.env["wsgi.input"],
                                                    self.encoding)
Esempio n. 3
0
	def _parse_get(self):
		s = self.env.get("QUERY_STRING", "")
		self.GET = parse_query_string(s, self.encoding)
Esempio n. 4
0
 def _parse_get(self):
     s = self.env.get("QUERY_STRING", "")
     self.GET = parse_query_string(s, self.encoding)