Skip to content
Permalink
Browse files

Fixing Accept header parsing so content types with leading/trailing s…

…paces

are treated as spaceless.
Fixes #1684
  • Loading branch information...
markstory committed Aug 26, 2011
1 parent ec79a09 commit 72ef310867c208a80a414114eba56befe3511055
@@ -176,6 +176,7 @@ class RequestHandlerComponent extends Object {
*/
function __construct() {
$this->__acceptTypes = explode(',', env('HTTP_ACCEPT'));
$this->__acceptTypes = array_map('trim', $this->__acceptTypes);
foreach ($this->__acceptTypes as $i => $type) {
if (strpos($type, ';')) {
@@ -469,7 +469,10 @@ function testRequestContentTypes() {
$this->_init();
$this->assertTrue($this->RequestHandler->isWap());
$_SERVER['HTTP_ACCEPT'] = 'application/rss+xml,text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,*/*';
$_SERVER['HTTP_ACCEPT'] = 'application/rss+xml , text/xml, application/xml,application/xhtml+xml';
$this->_init();
$this->assertFalse($this->RequestHandler->isAtom());
$this->assertTrue($this->RequestHandler->isRSS());
}
/**

0 comments on commit 72ef310

Please sign in to comment.
You can’t perform that action at this time.