Req #21115 [Fbk->NoF]: Function to parse Accept-like headers

From: Date: Tue, 30 Dec 2014 10:41:16 +0000
Subject: Req #21115 [Fbk->NoF]: Function to parse Accept-like headers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189358@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=21115&edit=1 ID: 21115 Updated by: php-bugs@lists.php.net Reported by: freaky at aagh dot net Summary: Function to parse Accept-like headers -Status: Feedback +Status: No Feedback Type: Feature/Change Request Package: *General Issues Operating System: Any PHP Version: * Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2014-04-16 18:11:15] levim@php.net Is this something you still have interest in? Last I knew you couldn't trust browsers to send decent accept headers anyway. This article is from 2009 but as far as I know things haven't changed since then: http://www.newmediacampaigns.com/blog/browser-rest-http-accept-headers ------------------------------------------------------------------------ [2002-12-20 10:40:06] freaky at aagh dot net Using content negotiation I often find myself wanting a low-cost but correct way of parsing Accept headers, e.g, Accept: for application/xhtml+xml or application/rdf+xml, or Accept-Language: for en/fr/de/klingon, or Accept-Encoding: for UTF, or whatever. Although parsing these in PHP isn't particularly difficult, it's fairly expensive if you want to do it properly, handling weights and levels -- most don't bother. A function to pass this work off to C would be nice, and would discourage broken Accept header checks that ignore weighting (e.g. just searching HTTP_ACCEPT for application/xhtml+xml breaks when it's q=0.0, and results in undesirable behavior when text/html has a higher q=). Given that serving XHTML as application/xhtml+xml is gaining in popularity, I think this would be a valuable addition to PHP's API. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=21115&edit=1

« previous php.bugs (#189358) next »