Fix qvalue parsing#2753
Conversation
|
Question: Introducing a regex which tests explicitly for RFC9110 makes the parsing very strict. Alternative would be to just allow plain floats and plain ints. I'd be happy to change the PR if needed |
|
I think this is good, and the right level of strictness. Yet, I also believe I'll change my mind after we find users caught out by it :conflicted: . If we do stay this strict, I don't think it can be a patch release. |
|
I like the idea of naming this specifically as |
I think generally you should be lenient in what you accept and strict in what you generate. Is there really a good reason to become more strict there when parsing? |
|
Nowadays I've observed more projects and maintainers leaning towards not accepting everything, because otherwise nothing gets fixed and no client/server can ever really conform to the standards. But here it doesn't really matter either way (I doubt most clients use more than one decimal place in practice), so I'm just staying lenient. |
Fixes #2751. Introduce proper regex for quality values as specified by RFC9110
parse_options_headerrejects q values "0" and "1" #2751Checklist:
CHANGES.rstsummarizing the change and linking to the issue... versionchanged::entries in any relevant code docs.pre-commithooks and fix any issues.pytestandtox, no tests failed.