Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def data_received(self, data: bytes):
try:
self.parser.feed_data(data)
except HttpParserUpgrade:
self.request.upgrade = True
except (HttpParserError, HttpParserInvalidMethodError) as exc:
# We should log the exc.
raise HTTPError(
HTTPStatus.BAD_REQUEST, 'Unparsable request.')
def data_received(self, data):
hrp = HttpRequestParser(self)
try:
hrp.feed_data(data)
self.request_version = hrp.get_http_version()
self.send_response()
except HttpParserInvalidMethodError:
self.data = data
self.error = True
self.bad_request()
except HttpParserError:
self.data = data
self.error = True
self.bad_request()