Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only sort the headers by key not by value #44

Merged
merged 2 commits into from Nov 21, 2013
Merged

only sort the headers by key not by value #44

merged 2 commits into from Nov 21, 2013

Conversation

@domruf
Copy link
Contributor

@domruf domruf commented Sep 19, 2013

I have a application that offers different kinds of authentication methods (Basic and Negotiate).
The problem is that Firefox uses them in the order they are listed in the HTTP header.
waitress currently sorts the headers by key and value which because Firefox to use Basic instead of Negotiate because it starts with B.

--HG--
extra : rebase_source : 28c8db5c527838341f125e10f8ec770352c92b75
@mmerickel
Copy link
Member

@mmerickel mmerickel commented Sep 19, 2013

Should the headers be sorted at all by waitress?

@domruf
Copy link
Contributor Author

@domruf domruf commented Sep 19, 2013

I don't know if there are any cases where the key order matters.
I guess it is easier to read when debugging.

@agroszer
Copy link
Contributor

@agroszer agroszer commented Sep 20, 2013

Testing comes to mind, when output matters

@domruf
Copy link
Contributor Author

@domruf domruf commented Sep 20, 2013

I found another place that manipulates the headers.
This time not only the order of the headers but the content.
In line 200 The headers get "capitalized".
But one of my clients seems to ignore Authenticate headers like 'Www-Authenticate' and only reads headers like 'WWW-Authenticate'

@domruf
Copy link
Contributor Author

@domruf domruf commented Sep 20, 2013

OK, I found the according text in the RFC.

http://www.ietf.org/rfc/rfc2616.txt (4.2) says

"...The order in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded..."

It also says

"Field names are case-insensitive"

So why would waitress capitalize the header names?

@mcdonc
Copy link
Member

@mcdonc mcdonc commented Nov 21, 2013

For what it's worth, I think you've misinterpreted the RFC section you quote. The section you quote deals with headers that have the same name, not headers that have different names. Regarding headers that have different names the spec says " The order in which header fields with differing field names are received is not significant."

@mcdonc
Copy link
Member

@mcdonc mcdonc commented Nov 21, 2013

Nope, nevermind, I misinterpreted your bug report and the test case you provided.

@mcdonc mcdonc merged commit e9ca506 into Pylons:master Nov 21, 2013
@mcdonc
Copy link
Member

@mcdonc mcdonc commented Nov 21, 2013

Thank you, this has been merged to master.

@mcdonc
Copy link
Member

@mcdonc mcdonc commented Nov 30, 2013

Waitress 0.8.8 is out with this fix.

@domruf
Copy link
Contributor Author

@domruf domruf commented Dec 2, 2013

great thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.