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()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scor’s picture

Status: Active » Needs review
Issue tags: +WSCCI
FileSize
29.03 KB

This 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.

Status: Needs review » Needs work

The last submitted patch, 1857138_1_dedicated_conneg.patch, failed testing.

Crell’s picture

Status: Needs work » Needs review
+++ b/core/lib/Drupal/Core/Mimeparse.php
@@ -0,0 +1,43 @@
+      $normalized = self::parseAndNormalizeMediaRange($r);

This should be static::, not self::. self:: probably should never be used anymore.

Crell’s picture

Status: Needs review » Needs work
scor’s picture

Title: Improve Content Negotiation with dedicated library » Improve Content Negotiation with dedicated library (mimeparse)
scor’s picture

Status: Needs work » Needs review
FileSize
660 bytes
36.51 KB

addressed crell's comment in #3.

The last submitted patch, 1857138_6_dedicated_conneg.patch, failed testing.

wamilton’s picture

Issue summary: View changes
Status: Needs work » Needs review

Poking testbot for a new list of broken stuff.

wamilton’s picture

Status: Needs review » Needs work

The last submitted patch, 6: 1857138_6_dedicated_conneg.patch, failed testing.

wamilton’s picture

Status: Needs work » Needs review
FileSize
34.94 KB

A reroll with composer cruft... fingers crossed.

Status: Needs review » Needs work

The last submitted patch, 11: 1857138_11_dedicated_conneg.patch, failed testing.

Crell’s picture

Status: Needs work » Closed (duplicate)

We're going with a stack approach: #2331919: Implement StackNegotiation