Optimize the content type search.

Move most commonly used types to the top
of the list.  This reduces the time spent
iterating content types.
This commit is contained in:
mark_story 2012-05-09 22:52:03 -04:00
parent 37d235fa16
commit 2c1b5d978d

View file

@ -80,6 +80,10 @@ class CakeResponse {
* @var array * @var array
*/ */
protected $_mimeTypes = array( protected $_mimeTypes = array(
'html' => array('text/html', '*/*'),
'json' => 'application/json',
'xml' => array('application/xml', 'text/xml'),
'rss' => 'application/rss+xml',
'ai' => 'application/postscript', 'ai' => 'application/postscript',
'bcpio' => 'application/x-bcpio', 'bcpio' => 'application/x-bcpio',
'bin' => 'application/octet-stream', 'bin' => 'application/octet-stream',
@ -206,7 +210,6 @@ class CakeResponse {
'f90' => 'text/plain', 'f90' => 'text/plain',
'h' => 'text/plain', 'h' => 'text/plain',
'hh' => 'text/plain', 'hh' => 'text/plain',
'html' => array('text/html', '*/*'),
'htm' => array('text/html', '*/*'), 'htm' => array('text/html', '*/*'),
'ics' => 'text/calendar', 'ics' => 'text/calendar',
'm' => 'text/plain', 'm' => 'text/plain',
@ -218,7 +221,6 @@ class CakeResponse {
'tpl' => 'text/template', 'tpl' => 'text/template',
'txt' => 'text/plain', 'txt' => 'text/plain',
'text' => 'text/plain', 'text' => 'text/plain',
'xml' => array('application/xml', 'text/xml'),
'avi' => 'video/x-msvideo', 'avi' => 'video/x-msvideo',
'fli' => 'video/x-fli', 'fli' => 'video/x-fli',
'mov' => 'video/quicktime', 'mov' => 'video/quicktime',
@ -261,12 +263,10 @@ class CakeResponse {
'pdb' => 'chemical/x-pdb', 'pdb' => 'chemical/x-pdb',
'xyz' => 'chemical/x-pdb', 'xyz' => 'chemical/x-pdb',
'javascript' => 'text/javascript', 'javascript' => 'text/javascript',
'json' => 'application/json',
'form' => 'application/x-www-form-urlencoded', 'form' => 'application/x-www-form-urlencoded',
'file' => 'multipart/form-data', 'file' => 'multipart/form-data',
'xhtml' => array('application/xhtml+xml', 'application/xhtml', 'text/xhtml'), 'xhtml' => array('application/xhtml+xml', 'application/xhtml', 'text/xhtml'),
'xhtml-mobile' => 'application/vnd.wap.xhtml+xml', 'xhtml-mobile' => 'application/vnd.wap.xhtml+xml',
'rss' => 'application/rss+xml',
'atom' => 'application/atom+xml', 'atom' => 'application/atom+xml',
'amf' => 'application/x-amf', 'amf' => 'application/x-amf',
'wap' => array('text/vnd.wap.wml', 'text/vnd.wap.wmlscript', 'image/vnd.wap.wbmp'), 'wap' => array('text/vnd.wap.wml', 'text/vnd.wap.wmlscript', 'image/vnd.wap.wbmp'),