Skip to content

Fix RequestHeaders to proper concat repeats - #10562

Merged
gsnedders merged 1 commit into
web-platform-tests:masterfrom
Spec-Ops:support-multiple-headers
Apr 30, 2018
Merged

gsnedders merged 1 commit into
web-platform-tests:masterfrom
Spec-Ops:support-multiple-headers

Conversation

@BigBlueHat

@BigBlueHat BigBlueHat commented Apr 21, 2018 •

Copy link
Copy Markdown
Member

Previously RequestHeaders only provided the last instance of a repeated header.

Reapplies the changes from w3c/wptserve#87 to fix #8367.


This change is Reviewable

Comment thread tools/wptserve/wptserve/request.py Outdated
self[key].append(value)
for header in items.keys():
key = header.lower()
# if there are other headers with this name, we need them

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get rid of the line by line comments?

maybe replace this one with get all headers with the same name

for value in values:
# split the raw header on the first `:`
# and add that to our list
multiples.append(value.split(':', 1)[1].strip())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace this one with getallmatchingheaders returns raw header lines, so split to get name, value

Comment thread tools/wptserve/wptserve/request.py Outdated
dict.__setitem__(self, key, multiples)
else:
dict.__setitem__(self, key, [value])
# adds the last header with this name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really the last (it's the only); still I think the comment is gratuitous.

Previously RequestHeaders only provided the last instance
of a repeated header.
@BigBlueHat
BigBlueHat force-pushed the support-multiple-headers branch from 92b207d to c85cd62 Compare April 25, 2018 17:04
@BigBlueHat

Copy link
Copy Markdown
Member Author

@gsnedders done.

@gsnedders
gsnedders merged commit 82530fb into web-platform-tests:master Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple request.headers handling

3 participants