-
Notifications
You must be signed in to change notification settings - Fork 62
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
Content type application/json selected incorrectly using Microsoft Edge headers #98
Comments
You have This does not seem invalid to me. |
IMO the more specific exact match to |
Indeed, could be and now I remember this: #83 (comment) |
Ah I see now that it is indeed the I'm now actually confused what content should be negotiated, as DISCLAIMER: The following is my opinion to get the ball rolling, feedback highly appreciated: First off, automatically lowering the E.g.
|
I ran into this too and have been thinking about ways to solve it. I see no way of solving this that still sticks to RFC 7231, which feels iffy to me. My gut feeling is that Microsoft is just doing it wrong. But I thought I’d still share my musings. I am of the opinion that the contents of the According to the RFC, “the most specific reference has precedence” when assigning quality values. So clearly specificity is a concept that is still in effect even in our unordered set. If we can accept specificity to have bearing on preference, it becomes possible to apply bonus quality to the more specific media ranges. For those who know about CSS this is a familiar topic. Quality values are in the range 0–1 with at most 3 decimal places used. For my tweaking of the algorithm I can use a fourth decimal place. This will allow for a media range to be preferred over another without accidentally making it compete with one that was specified with a higher value.
The IE Accept: text/html;q=1.0002, application/xhtml+xml;q=1.0002, image/jxr;q=1.0002, */*;q=1.0000 This means Of course this will come with its own set of corner cases. Here is the outcome of following these steps on @emrysal’s examples:
|
@willdurand would you accept a patch with @Zegnat proposition? |
I guess? As long as there are new test cases and that existing ones don't break (OR it is very clear why they need to be updated), I am fine with pretty much everything. |
Hi all,
This was a interesting case encountered using the Microsoft Edge (41.16299.15.0) browser, which sends the following headers by default.
Accept: text/html, application/xhtml+xml, image/jxr, */*
When the priorities are prioritised with
application/json, text/html
; then the Content Negotiation will prefer theapplication/json
response type; this should clearly prefertext/html
based on the headers send by Edge.I worked around the issue by changing the priority from
application/json, text/html
=>text/html, application/json
. But I thought it a good idea to flag this issue.I've written some tests which expose this behaviour, the following is the (invalid) 'passing' test.
This seems to be caused by the index, but I am not exactly sure what the correct fix would be, hense the lack of a PR. My best guess is that application/xhtml+xml should not match application/json in any way, as they are radically different.
The text was updated successfully, but these errors were encountered: