#36411: MediaType.get_preferred_type ignores params
-------------------------------------+-------------------------------------
Reporter: magicfelix | Owner: Jake
| Howard
Type: Bug | Status: closed
Component: HTTP handling | Version: 5.2
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nessita <124304+nessita@…>):
* resolution: => fixed
* status: assigned => closed
Comment:
In [changeset:"c075508b4de8edf9db553b409f8a8ed2f26ecead" c075508b]:
{{{#!CommitTicketReference repository=""
revision="c075508b4de8edf9db553b409f8a8ed2f26ecead"
Fixed #36411 -- Made HttpRequest.get_preferred_type() consider media type
parameters.
HttpRequest.get_preferred_type() did not account for parameters in
Accept header media types (e.g., "text/vcard; version=3.0"). This caused
incorrect content negotiation when multiple types differed only by
parameters, reducing specificity as per RFC 7231 section 5.3.2
(
https://datatracker.ietf.org/doc/html/rfc7231.html#section-5.3.2).
This fix updates get_preferred_type() to treat media types with
parameters as distinct, allowing more precise and standards-compliant
matching.
Thanks to magicfelix for the report, and to David Sanders and Sarah
Boyce for the reviews.
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/36411#comment:16>