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

From: Date: Wed, 16 Apr 2014 18:11:16 +0000
Subject: Req #21115 [Opn->Fbk]: Function to parse Accept-like headers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185285@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: levim@php.net Reported by: freaky at aagh dot net Summary: Function to parse Accept-like headers -Status: Open +Status: Feedback Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues -Operating System: +Operating System: Any -PHP Version: 4.2.3 +PHP Version: * Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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 (#185285) next »