Commit c1288558 authored by Pavel Spirek's avatar Pavel Spirek

Bugfix: HEAD method returning zero content-length

parent 0461a985
...@@ -65,6 +65,7 @@ class HttpResponse: ...@@ -65,6 +65,7 @@ class HttpResponse:
def __init__(self, status: HttpStatus, data: bytes, content_type: str, extra_headers: OrderedDict=None): def __init__(self, status: HttpStatus, data: bytes, content_type: str, extra_headers: OrderedDict=None):
self.status_code = status.code self.status_code = status.code
self.data = data self.data = data
self.content_length = len(data)
self.content_type = content_type self.content_type = content_type
self.extra_headers = extra_headers self.extra_headers = extra_headers
......
...@@ -157,7 +157,7 @@ class H2Protocol(asyncio.Protocol): ...@@ -157,7 +157,7 @@ class H2Protocol(asyncio.Protocol):
resp_headers = ( resp_headers = (
(":status", resp.status_code), (":status", resp.status_code),
("Content-Type", resp.content_type), ("Content-Type", resp.content_type),
("Content-Length", str(len(resp.data))), ("Content-Length", str(resp.content_length)),
("Server", CONFIG_HTTP["SERVER_NAME"]), ("Server", CONFIG_HTTP["SERVER_NAME"]),
("Access-Control-Allow-Origin", CONFIG_HTTP["AC_ALLOW_ORIGIN"]) ("Access-Control-Allow-Origin", CONFIG_HTTP["AC_ALLOW_ORIGIN"])
) )
......
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