Skip to content

Commit

Permalink
Note on title casing in set_headers
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie authored and pgjones committed Oct 4, 2020
1 parent 3be20c5 commit 0aac921
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions h11/_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ def get_comma_header(headers, name):

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

0 comments on commit 0aac921

Please sign in to comment.