Only use request.body
This commit is contained in:
parent
85a28d3c30
commit
fd118a41fd
|
@ -54,7 +54,7 @@ class Request(dict):
|
||||||
self.query_string = url_parsed.query.decode('utf-8')
|
self.query_string = url_parsed.query.decode('utf-8')
|
||||||
|
|
||||||
# Init but do not inhale
|
# Init but do not inhale
|
||||||
self.body = None
|
self.body = []
|
||||||
self.parsed_json = None
|
self.parsed_json = None
|
||||||
self.parsed_form = None
|
self.parsed_form = None
|
||||||
self.parsed_files = None
|
self.parsed_files = None
|
||||||
|
|
|
@ -49,7 +49,7 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
# event loop, connection
|
# event loop, connection
|
||||||
'loop', 'transport', 'connections', 'signal',
|
'loop', 'transport', 'connections', 'signal',
|
||||||
# request params
|
# request params
|
||||||
'parser', 'request', 'url', 'headers', 'body',
|
'parser', 'request', 'url', 'headers',
|
||||||
# request config
|
# request config
|
||||||
'request_handler', 'request_timeout', 'request_max_size',
|
'request_handler', 'request_timeout', 'request_max_size',
|
||||||
# connection management
|
# connection management
|
||||||
|
@ -64,7 +64,6 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
self.parser = None
|
self.parser = None
|
||||||
self.url = None
|
self.url = None
|
||||||
self.headers = None
|
self.headers = None
|
||||||
self.body = []
|
|
||||||
self.signal = signal
|
self.signal = signal
|
||||||
self.connections = connections
|
self.connections = connections
|
||||||
self.request_handler = request_handler
|
self.request_handler = request_handler
|
||||||
|
@ -149,11 +148,11 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_body(self, body):
|
def on_body(self, body):
|
||||||
self.body.append(body)
|
self.request.body.append(body)
|
||||||
|
|
||||||
def on_message_complete(self):
|
def on_message_complete(self):
|
||||||
if self.body:
|
if self.request.body:
|
||||||
self.request.body = b''.join(self.body)
|
self.request.body = b''.join(self.request.body)
|
||||||
self._request_handler_task = self.loop.create_task(
|
self._request_handler_task = self.loop.create_task(
|
||||||
self.request_handler(self.request, self.write_response))
|
self.request_handler(self.request, self.write_response))
|
||||||
|
|
||||||
|
@ -217,7 +216,6 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
self.request = None
|
self.request = None
|
||||||
self.url = None
|
self.url = None
|
||||||
self.headers = None
|
self.headers = None
|
||||||
self.body = []
|
|
||||||
self._request_handler_task = None
|
self._request_handler_task = None
|
||||||
self._total_request_size = 0
|
self._total_request_size = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user