2005-03-18 21:41:13 -05:00
|
|
|
! Copyright (C) 2004, 2005 Slava Pestov.
|
2006-01-12 23:01:12 -05:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2005-03-18 21:41:13 -05:00
|
|
|
IN: httpd
|
2006-01-12 23:01:12 -05:00
|
|
|
USING: io hashtables kernel sequences math namespaces ;
|
2005-03-18 21:41:13 -05:00
|
|
|
|
2005-12-10 01:02:13 -05:00
|
|
|
: file-extension ( filename -- extension )
|
|
|
|
"." split dup length 1 <= [ drop f ] [ peek ] if ;
|
|
|
|
|
2005-03-18 21:41:13 -05:00
|
|
|
: mime-type ( filename -- mime-type )
|
2005-11-29 23:49:59 -05:00
|
|
|
file-extension "mime-types" get
|
|
|
|
hash [ "text/plain" ] unless* ;
|
2005-03-18 21:41:13 -05:00
|
|
|
|
2005-11-29 23:49:59 -05:00
|
|
|
H{
|
|
|
|
{ "html" "text/html" }
|
|
|
|
{ "txt" "text/plain" }
|
|
|
|
{ "xml" "text/xml" }
|
|
|
|
{ "css" "text/css" }
|
2005-03-18 21:41:13 -05:00
|
|
|
|
2005-11-29 23:49:59 -05:00
|
|
|
{ "gif" "image/gif" }
|
|
|
|
{ "png" "image/png" }
|
|
|
|
{ "jpg" "image/jpeg" }
|
|
|
|
{ "jpeg" "image/jpeg" }
|
2005-03-18 21:41:13 -05:00
|
|
|
|
2005-11-29 23:49:59 -05:00
|
|
|
{ "jar" "application/octet-stream" }
|
|
|
|
{ "zip" "application/octet-stream" }
|
|
|
|
{ "tgz" "application/octet-stream" }
|
|
|
|
{ "tar.gz" "application/octet-stream" }
|
|
|
|
{ "gz" "application/octet-stream" }
|
2005-12-24 18:29:31 -05:00
|
|
|
|
|
|
|
{ "pdf" "application/pdf" }
|
2005-03-18 21:41:13 -05:00
|
|
|
|
2005-11-29 23:49:59 -05:00
|
|
|
{ "factor" "application/x-factor" }
|
|
|
|
{ "factsp" "application/x-factor-server-page" }
|
|
|
|
} "mime-types" global set-hash
|