Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
This is a split from #1505080: [META] Content Negotiation for Accept Headers where a better content negotiation for Symfony is under discussion. It is not sure if/when Symfony will this improved content negotiation logic, and in the meantime it was suggested for Drupal to implement its own a stop gap measure.
Proposed resolution
Use the mimeparse library.
Remaining tasks
finish the WIP patch.
User interface changes
none
API changes
additional class and method Mimeparse::getWeightedAcceptableContentTypes()
Comment | File | Size | Author |
---|---|---|---|
#11 | 1857138_11_dedicated_conneg.patch | 34.94 KB | wamilton |
#6 | 1857138_6_dedicated_conneg.patch | 36.51 KB | scor |
#6 | interdiff.txt | 660 bytes | scor |
#1 | 1857138_1_dedicated_conneg.patch | 29.03 KB | scor |
Comments
Comment #1
scor CreditAttribution: scor commentedThis patch include the mimeparse library as well as a new Mimeparse subsystem in core/lib/Drupal/Core/Mimeparse.php where I've added some logic to adapt mimeparse to our needs (in particular preserving the quality factors along with the MIME types). The default conneg and the MIME type partial matcher have been adapted to use this new library.
setting to needs review to see what the testbot says.
Comment #3
Crell CreditAttribution: Crell commentedThis should be static::, not self::. self:: probably should never be used anymore.
Comment #4
Crell CreditAttribution: Crell commentedComment #5
scor CreditAttribution: scor commentedComment #6
scor CreditAttribution: scor commentedaddressed crell's comment in #3.
Comment #8
wamilton CreditAttribution: wamilton commentedPoking testbot for a new list of broken stuff.
Comment #9
wamilton CreditAttribution: wamilton commented6: 1857138_6_dedicated_conneg.patch queued for re-testing.
Comment #11
wamilton CreditAttribution: wamilton commentedA reroll with composer cruft... fingers crossed.
Comment #12
Crell CreditAttribution: Crell commentedLet's get #2026431: Make ContentNegotiation a "internal" service, used only by the router, so that core or contrib can implement real negotiation in first, as that gives us more leeway here.
Comment #14
Crell CreditAttribution: Crell commentedWe're going with a stack approach: #2331919: Implement StackNegotiation