Open
Description
Hi there 👋
I was trying to improve the test coverage on Uvicorn, and I noticed something interesting...
The server can't send connection: close
headers on Response. If you set it, h11
will convert it to Connection: close
(capitalized version).
This code:
print(headers)
event = h11.Response(
status_code=status_code, headers=headers, reason=reason
)
print(event)
output = self.conn.send(event)
print(output)
Outputs the following:
[[b'content-type', b'text/plain; charset=utf-8'], [b'content-length', b'12'], (b'connection', b'close')]
Response(status_code=200, headers=<Headers([(b'content-type', b'text/plain; charset=utf-8'), (b'content-length', b'12'), (b'connection', b'close')])>, http_version=b'1.1', reason=b'OK')
b'HTTP/1.1 200 OK\r\ncontent-type: text/plain; charset=utf-8\r\ncontent-length: 12\r\nConnection: close\r\n\r\n'
So... I'm here looking for instructions, more than "asking to change". Is it fine to be like this? I want this info, so I can write proper tests on uvicorn
, as the other HTTP implementation uses httptools
, and I can send connection: close
there.
Metadata
Metadata
Assignees
Labels
No labels