Skip to content

Commit 0aac921

Browse files
tomchristiepgjones
authored andcommitted
Note on title casing in set_headers
1 parent 3be20c5 commit 0aac921

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

h11/_headers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ def get_comma_header(headers, name):
206206

207207
def set_comma_header(headers, name, new_values):
208208
# The header name `name` is expected to be lower-case bytes.
209+
#
210+
# Note that when we store the header we use title casing for the header
211+
# names, in order to match the conventional HTTP header style.
212+
#
213+
# Simply calling `.title()` is a blunt approach, but it's correct
214+
# here given the cases where we're using `set_comma_header`...
215+
#
216+
# Connection, Content-Length, Transfer-Encoding.
209217
new_headers = []
210218
for found_raw_name, found_name, found_raw_value in headers._full_items:
211219
if found_name != name:

0 commit comments

Comments
 (0)