Re: [PHP-DEV] Adding new MIME types for the CLI web server

2013-11-01 Thread Andrea Faulds



On 31/10/13 21:32, Derick Rethans wrote:


Isn't there a reason why you can't use the fileinfo extension/code for
this instead? Hardcoding it seems rather strange?



I looked at the manual and mime_content_type() is deprecated and tells 
me to use the Fileinfo PECL extension. From which I am led back to the 
parent section, which is for the built-in Fileinfo extension. Looks like 
the manual is out-of-date.


Anyhow, looks like finfo_file() works as we'd want, though I feel uneasy 
about guessing filetypes this way. Perhaps we should have several 
explicitly specified ones (.txt as text/plain, .html as text/html, 
etc.), and guess the rest? Especially for ones which it would not 
correctly guess.


Thanks.
--
Andrea Faulds
http://ajf.me/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Adding new MIME types for the CLI web server

2013-11-01 Thread Stas Malyshev
Hi!

 Final comments anyone, before I commit next week?

It looks strange that we have to hardcode so many mimetypes in the code,
and doesn't sound a scalable solution. Can't we make it use data from
fileinfo or some other customizeable table so we don't have to keep all
MIME types hardcoded in the code? Maybe some ability to use Apache's
mime.types file?
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Adding new MIME types for the CLI web server

2013-11-01 Thread Derick Rethans
On Thu, 31 Oct 2013, Christopher Jones wrote:

 The PHP CLI web server 5.5 currrently supports these MIME types 
 natively:
 
   { html, text/html },
   { htm, text/html },
   { js, text/javascript },
   { css, text/css },
   { gif, image/gif },
   { jpg, image/jpeg },
   { jpeg, image/jpeg },
   { jpe, image/jpeg },
   { png, image/png },
   { svg, image/svg+xml },
   { txt, text/plain },
   { webm, video/webm },
   { ogv, video/ogg },
   { ogg, audio/ogg },
 
 
 Final comments anyone, before I commit next week?

Isn't there a reason why you can't use the fileinfo extension/code for 
this instead? Hardcoding it seems rather strange?

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Adding new MIME types for the CLI web server

2013-11-01 Thread Christopher Jones



On 10/31/13 4:12 PM, Stas Malyshev wrote:

Hi!


Final comments anyone, before I commit next week?


It looks strange that we have to hardcode so many mimetypes in the code,
and doesn't sound a scalable solution. Can't we make it use data from
fileinfo or some other customizeable table so we don't have to keep all
MIME types hardcoded in the code? Maybe some ability to use Apache's
mime.types file?



It isn't scalable, but users can always use a router script to add
additional types so there isn't a real world problem in missing
uncommon extensions.

My idea was to add common extensions to the existing look-up list.  A
quick and straight-forward solution to making the CLI web-server
handle the 80-20 rule.

If someone (ajf?) wants to work on a more comprehensive solution
instead, I have no objection.

Chris

--
christopher.jo...@oracle.com  http://twitter.com/ghrd
Free PHP  Oracle book:
http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Adding new MIME types for the CLI web server

2013-10-26 Thread Christopher Jones

I'm planning on adding some MIME type to the CLI web server.

For PHP 5.5.5 CLI web server I added the .pdf MIME type.  I was using
the webserver for a conference exhibition hall demo and needed to
present a PDF.

Some other multi-media types could be useful in future situations, and
in general.  I'm thinking of adding these to PHP 5.5.6  master:

   { avi,  video/x-msvideo },
   { flv,  video/x-flv },
   { swf,  application/x-shockwave-flash },
   { qt,   video/quicktime },
   { mov,  video/quicktime },
   { mp3,  audio/mpeg },
   { mp4,  video/mpeg },
   { mpg,  video/mpeg },
   { mpeg, video/mpeg },
   { wav,  audio/wav },

Notes:

- A router can be used to add to, or override, the MIME type lookups,
  see http://php.net/manual/en/features.commandline.webserver.php

- The web server code does a linear lookup through the MIME table,
  defaulting on failure to returning application/octet-stream.

--
christopher.jo...@oracle.com  http://twitter.com/ghrd
Free PHP  Oracle book:
http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php