php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21115 Function to parse Accept-like headers
Submitted: 2002-12-20 10:40 UTC Modified: 2014-12-30 10:41 UTC
Votes:15
Avg. Score:4.1 ± 1.1
Reproduced:14 of 14 (100.0%)
Same Version:2 (14.3%)
Same OS:2 (14.3%)
From: freaky at aagh dot net Assigned:
Status: No Feedback Package: *General Issues
PHP Version: * OS: Any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-12-20 10:40 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-16 18:11 UTC] levim@php.net
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues -Operating System: +Operating System: Any -PHP Version: 4.2.3 +PHP Version: *
 [2014-04-16 18:11 UTC] 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
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC