Commit 9b16b1b4 authored by Phil Jones's avatar Phil Jones
Browse files

Allow control over date header addition

This allows for Hypercorn to be used behind servers/proxies that add
this header as well.
parent 058e84f5
Pipeline #476147141 passed with stages
in 3 minutes
......@@ -76,6 +76,7 @@ class Config:
h2_max_concurrent_streams = 100
h2_max_header_list_size = 2**16
h2_max_inbound_frame_size = 2**14 * OCTETS
include_date_header = True
include_server_header = True
keep_alive_timeout = 5 * SECONDS
keyfile: Optional[str] = None
......@@ -267,7 +268,9 @@ class Config:
return sockets
def response_headers(self, protocol: str) -> List[Tuple[bytes, bytes]]:
headers = [(b"date", format_date_time(time()).encode("ascii"))]
headers = []
if self.include_date_header:
headers.append((b"date", format_date_time(time()).encode("ascii")))
if self.include_server_header:
headers.append((b"server", f"hypercorn-{protocol}".encode("ascii")))
......
Supports Markdown
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