add check for header and value
This commit is contained in:
parent
514540b90b
commit
dc411651b6
|
@ -166,11 +166,12 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
def on_header(self, name, value):
|
def on_header(self, name, value):
|
||||||
print(f'header "{name}": "{value}"')
|
print(f'header "{name}": "{value}"')
|
||||||
|
|
||||||
if name == b'Content-Length' and int(value) > self.request_max_size:
|
if name and value:
|
||||||
exception = PayloadTooLarge('Payload Too Large')
|
if name == b'Content-Length' and int(value) > self.request_max_size:
|
||||||
self.write_error(exception)
|
exception = PayloadTooLarge('Payload Too Large')
|
||||||
|
self.write_error(exception)
|
||||||
|
|
||||||
self.headers.append((name.decode().casefold(), value.decode()))
|
self.headers.append((name.decode().casefold(), value.decode()))
|
||||||
|
|
||||||
def on_headers_complete(self):
|
def on_headers_complete(self):
|
||||||
self.request = self.request_class(
|
self.request = self.request_class(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user