Merge pull request #342 from channelcat/fix-slow-upload

Fix slow upload
This commit is contained in:
Channel Cat 2017-01-25 22:04:48 -08:00 committed by GitHub
commit 88c3bffe20
2 changed files with 4 additions and 5 deletions

View File

@ -54,7 +54,7 @@ class Request(dict):
self.query_string = url_parsed.query.decode('utf-8')
# Init but do not inhale
self.body = None
self.body = []
self.parsed_json = None
self.parsed_form = None
self.parsed_files = None

View File

@ -148,12 +148,11 @@ class HttpProtocol(asyncio.Protocol):
)
def on_body(self, body):
if self.request.body:
self.request.body += body
else:
self.request.body = body
self.request.body.append(body)
def on_message_complete(self):
if self.request.body:
self.request.body = b''.join(self.request.body)
self._request_handler_task = self.loop.create_task(
self.request_handler(self.request, self.write_response))