ZF-820: Method in Zend_Controller_Request_Http for analyzing USER_AGENT

Description

This is a feature request for a method in Zend_Controller_Request_Http to provide structured information about the request's USER_AGENT to a ZF application.

Sometimes an application must output custom markup, javascript, or css depending on the browser brand or version. Parsing the USER_AGENT of a request is difficult and error-prone, because so many browsers use nonstandard syntax.

It makes sense that the Zend Framework can provide a "best-practices" method to parse known USER_AGENT strings and return the information in some kind of canonical, structured form, using an associative array for individual information pieces for instance. Then this information can be used by the View or even by the Controller to deliver custom output in the response.

References: http://www.faqs.org/rfcs/rfc1945.html http://www.faqs.org/rfcs/rfc2068.html http://www.dotvoid.com/view.php?id=68 http://texsoft.it/index.php/…

This is probably not a mandatory feature for ZF 1.0, but we may want to revisit this in a subsequent release.

Comments

Scheduling for 1.1.0

In addition to that, ZendFramework could care about the wonderfull PHP function called get_browser(). browscap.ini must be provided in php.ini for that function to work, so ZF could check about that, and use it if available in addition to 'standard parsings'

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Scheduling for next minor release; would be good to have for use with ContextSwitch.

This could serve as well for a future HTTP-based caching mechanism.

I suggest the creation of classe(s) and object(s) that could answer


$infos = $request->getClientInfo();
$info-> ...

- isIE(), isFireFox() is{any-familly}()
- getVersion()
- supportsCompression()
- supportsCookies() (that needs a 3xx refresh ...)
- isFlashRequest() and isXmlHttpRequest() could move to that object
- getLanguage() to map with Zend_Locale that actually does the job itself if I remember
- getIP()
- isProxied()

Just some ideas ...

Resolved by the addition of Zend_Http_UserAgent in ZF 1.11.