mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
style: fix example
This commit is contained in:
parent
53cf1fbde0
commit
64df8616f9
1 changed files with 11 additions and 11 deletions
|
|
@ -23,17 +23,17 @@ let () =
|
||||||
in
|
in
|
||||||
let ic = open_in path in
|
let ic = open_in path in
|
||||||
let str = S.Byte_stream.of_chan ic in
|
let str = S.Byte_stream.of_chan ic in
|
||||||
let mime_type =
|
let mime_type =
|
||||||
try
|
try
|
||||||
let p = Unix.open_process_in (Printf.sprintf "file -i -b %S" path) in
|
let p = Unix.open_process_in (Printf.sprintf "file -i -b %S" path) in
|
||||||
try
|
try
|
||||||
let s = ["Content-Type", String.trim (input_line p)] in
|
let s = ["Content-Type", String.trim (input_line p)] in
|
||||||
ignore @@ Unix.close_process_in p;
|
ignore @@ Unix.close_process_in p;
|
||||||
s
|
s
|
||||||
with _ -> ignore @@ Unix.close_process_in p; []
|
with _ -> ignore @@ Unix.close_process_in p; []
|
||||||
with _ -> []
|
with _ -> []
|
||||||
in
|
in
|
||||||
S.Response.make_stream ~headers:mime_type (Ok str)
|
S.Response.make_stream ~headers:mime_type (Ok str)
|
||||||
);
|
);
|
||||||
(* echo request *)
|
(* echo request *)
|
||||||
S.add_path_handler server
|
S.add_path_handler server
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue