Merge pull request #223 from r0fls/115

Raise error if response is malformed.
This commit is contained in:
Eli Uriegas
2016-12-24 17:12:17 -08:00
committed by GitHub
2 changed files with 21 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ from signal import SIGINT, SIGTERM
from time import time
from httptools import HttpRequestParser
from httptools.parser.errors import HttpParserError
from .exceptions import ServerError
try:
import uvloop as async_loop
@@ -173,8 +174,9 @@ class HttpProtocol(asyncio.Protocol):
"Writing error failed, connection closed {}".format(e))
def bail_out(self, message):
log.debug(message)
self.transport.close()
exception = ServerError(message)
self.write_error(exception)
log.error(message)
def cleanup(self):
self.parser = None