Skip to content

Commit 01ee80d

Browse files
committed
FEAT: using mime-types module in httpd scheme for more complete list of mime types
1 parent 5f2b6a5 commit 01ee80d

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

src/modules/httpd.reb

+3-34
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Rebol [
3636
]
3737
]
3838

39+
import 'mime-types
40+
3941
append system/options/log [httpd: 1]
4042

4143
;------------------------------------------------------------------------
@@ -461,39 +463,6 @@ sys/make-scheme [
461463
;511 "Network Authentication Required"
462464
]
463465

464-
MIME-Types: make map! [
465-
%.txt "text/plain"
466-
%.html "text/html"
467-
%.htm "text/html"
468-
%.js "text/javascript"
469-
%.css "text/css"
470-
%.csv "text/csv"
471-
%.ics "text/calendar"
472-
%.gif "image/gif"
473-
%.png "image/png"
474-
%.jpg "image/jpeg"
475-
%.jpeg "image/jpeg"
476-
%.ico "image/x-icon"
477-
%.svg "image/svg+xml"
478-
%.json "application/json"
479-
%.pdf "application/pdf"
480-
%.swf "application/x-shockwave-flash"
481-
%.wasm "application/wasm"
482-
%.xls "application/vnd.ms-excel"
483-
%.xlsx "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
484-
%.zip "application/zip"
485-
%.7z "application/x-7z-compressed"
486-
%.doc "application/msword"
487-
%.wav "audio/wav"
488-
%.mid "audio/midi"
489-
%.midi "audio/x-midi"
490-
%.otf "font/otf"
491-
%.ttf "font/ttf"
492-
%.woff "font/woff"
493-
%.woff2 "font/woff2"
494-
%.xhtml "application/xhtml+xml"
495-
]
496-
497466
Respond: function [port [port!]][
498467
ctx: port/extra
499468
out: ctx/out
@@ -504,7 +473,7 @@ sys/make-scheme [
504473

505474
unless out/header/Content-Type [
506475
if out/target [
507-
out/header/Content-Type: pick MIME-Types suffix? out/target
476+
out/header/Content-Type: mime-type? out/target
508477
]
509478
if all [
510479
none? out/header/Content-Type ; no mime found above

0 commit comments

Comments
 (0)