0001-misc-process-request-input-without-calling-to-quixot.patch
wcs/qommon/http_request.py | ||
---|---|---|
128 | 128 |
def process_inputs(self): |
129 | 129 |
if self.parsed: |
130 | 130 |
return |
131 |
query = self.get_query() |
|
132 |
if query: |
|
133 |
self.form.update(quixote.http_request.parse_query(query, self.charset)) |
|
131 | 134 |
length = self.environ.get('CONTENT_LENGTH') or '0' |
132 | 135 |
try: |
133 | 136 |
length = int(length) |
134 | 137 |
except ValueError: |
135 | 138 |
raise RequestError('invalid content-length header') |
136 | 139 |
ctype = self.environ.get("CONTENT_TYPE") |
140 |
if self.django_request: |
|
141 |
self.stdin = self.django_request |
|
137 | 142 |
if ctype: |
138 | 143 |
ctype, ctype_params = quixote.http_request.parse_header(ctype) |
139 |
if length and ctype not in ('application/x-www-form-urlencoded', 'multipart/form-data'): |
|
140 |
self.stdin = self.django_request |
|
141 |
quixote.http_request.HTTPRequest.process_inputs(self) |
|
142 |
if ctype == 'application/json' and self.stdin: |
|
144 |
if ctype == 'application/x-www-form-urlencoded': |
|
145 |
self._process_urlencoded(length, ctype_params) |
|
146 |
elif ctype == 'multipart/form-data': |
|
147 |
self._process_multipart(length, ctype_params) |
|
148 |
elif ctype == 'application/json' and self.stdin: |
|
143 | 149 |
from .misc import json_loads |
144 | 150 |
length = int(self.environ.get('CONTENT_LENGTH') or '0') |
145 |
self.stdin.seek(0) # quixote will have consumed the body |
|
146 | 151 |
payload = self.stdin.read(length) |
147 | 152 |
try: |
148 | 153 |
self._json = json_loads(payload) |
149 |
- |