Commit 17abe9bc authored by Elvis Pranskevichus's avatar Elvis Pranskevichus

http_server: Fix memory leak and performance issue with TCP_NODELAY

parent a17a54d7
......@@ -33,14 +33,14 @@ class HttpResponse:
self._headers_sent = False
def write(self, data):
self._protocol._transport.writelines([
self._protocol._transport.write(b''.join([
'HTTP/{} 200 OK\r\n'.format(
self._request._version).encode('latin-1'),
b'Content-Type: text/plain\r\n',
'Content-Length: {}\r\n'.format(len(data)).encode('latin-1'),
b'\r\n',
data
])
]))
class HttpProtocol(asyncio.Protocol):
......@@ -100,6 +100,7 @@ class HttpProtocol(asyncio.Protocol):
else:
payload_size = int(payload_size)
response.write(b'X' * payload_size)
self._current_headers = []
def abort(msg):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment