mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 03:05:29 -05:00
workaround for css/js in http_of_dir
This commit is contained in:
parent
6b57540b50
commit
ff5795c389
1 changed files with 5 additions and 1 deletions
|
|
@ -198,7 +198,11 @@ let serve ~config (dir:string) : _ result =
|
||||||
try
|
try
|
||||||
let ic = open_in full_path in
|
let ic = open_in full_path in
|
||||||
let mime_type =
|
let mime_type =
|
||||||
try
|
if Filename.extension full_path = ".css" then (
|
||||||
|
["Content-Type", "text/css"]
|
||||||
|
) else if Filename.extension full_path = ".js" then (
|
||||||
|
["Content-Type", "text/javascript"]
|
||||||
|
) else try
|
||||||
let p = Unix.open_process_in (Printf.sprintf "file -i -b %S" full_path) in
|
let p = Unix.open_process_in (Printf.sprintf "file -i -b %S" full_path) in
|
||||||
finally_ ~h:(fun p->ignore @@ Unix.close_process_in p) p
|
finally_ ~h:(fun p->ignore @@ Unix.close_process_in p) p
|
||||||
(fun p ->
|
(fun p ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue