Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self._total_request_size > self.request_max_size:
self.write_error(PayloadTooLarge("Payload too large"))
# Create parser if this is the first time we're receiving data
if self.parser is None:
assert self.request is None
self.headers = []
self.parser = HttpRequestParser(self)
# requests count
self.state["requests_count"] = self.state["requests_count"] + 1
# Parse request chunk or close connection
try:
self.parser.feed_data(data)
except HttpParserError:
message = "Bad Request"
if self._debug:
message += "\n" + traceback.format_exc()
self.write_error(InvalidUsage(message))
'HttpParserUpgrade')
class HttpParserError(Exception):
pass
class HttpParserCallbackError(HttpParserError):
pass
class HttpParserInvalidStatusError(HttpParserError):
pass
class HttpParserInvalidMethodError(HttpParserError):
pass
class HttpParserInvalidURLError(HttpParserError):
pass
class HttpParserUpgrade(Exception):
pass
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()
pass
class HttpParserCallbackError(HttpParserError):
pass
class HttpParserInvalidStatusError(HttpParserError):
pass
class HttpParserInvalidMethodError(HttpParserError):
pass
class HttpParserInvalidURLError(HttpParserError):
pass
class HttpParserUpgrade(Exception):
pass
'HttpParserCallbackError',
'HttpParserInvalidStatusError',
'HttpParserInvalidMethodError',
'HttpParserInvalidURLError',
'HttpParserUpgrade')
class HttpParserError(Exception):
pass
class HttpParserCallbackError(HttpParserError):
pass
class HttpParserInvalidStatusError(HttpParserError):
pass
class HttpParserInvalidMethodError(HttpParserError):
pass
class HttpParserInvalidURLError(HttpParserError):
pass
class HttpParserUpgrade(Exception):
pass
__all__ = ('HttpParserError',
'HttpParserCallbackError',
'HttpParserInvalidStatusError',
'HttpParserInvalidMethodError',
'HttpParserInvalidURLError',
'HttpParserUpgrade')
class HttpParserError(Exception):
pass
class HttpParserCallbackError(HttpParserError):
pass
class HttpParserInvalidStatusError(HttpParserError):
pass
class HttpParserInvalidMethodError(HttpParserError):
pass
class HttpParserInvalidURLError(HttpParserError):
pass
class HttpParserUpgrade(Exception):
if self._total_request_size > self.request_max_size:
self.write_error(PayloadTooLarge("Payload Too Large"))
# Create parser if this is the first time we're receiving data
if self.parser is None:
assert self.request is None
self.headers = []
self.parser = HttpRequestParser(self)
# requests count
self.state["requests_count"] = self.state["requests_count"] + 1
# Parse request chunk or close connection
try:
self.parser.feed_data(data)
except HttpParserError:
message = "Bad Request"
if self._debug:
message += "\n" + traceback.format_exc()
self.write_error(InvalidUsage(message))