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

Output not always matching the examples from RFC 7231 and RFC 9110 #53

Open
vytas7 opened this issue Oct 1, 2024 · 0 comments
Open

Comments

@vytas7
Copy link
Member

vytas7 commented Oct 1, 2024

Although much of the negotiation is dependent on the specific server logic, it feels that the current implementation does not always follow the spirit of the HTTP semantics as detailed in RFC 7231 (now superseded by 9110, but 7231 has IMHO clearer examples) and RFC 9110.

Cf

>>> mimeparse.quality('text/html;level=3', 'text/*;q=0.3, text/html;q=0.7, text/html;level=1,text/html;level=2;q=0.4, */*;q=0.5')
0.7
>>> # So far so good. text/html;level=3 does not match the ranges for level=1 and level=2, so we get the generic value (0.7).
>>> # Now, just change the order of the example:
>>> mimeparse.quality('text/html;level=3', 'text/*;q=0.3, text/html;level=1, text/html;q=0.7, text/html;level=2;q=0.4, */*;q=0.5')
1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant