Update src/Tiny_httpd_dir.ml

This commit is contained in:
Simon Cruanes 2021-12-20 09:52:23 -05:00 committed by GitHub
parent ce4b5f0a11
commit e1ddb96e7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,7 +34,7 @@ let contains_dot_dot s =
let human_size (x:int) : string = let human_size (x:int) : string =
if x >= 1_000_000_000 then Printf.sprintf "%d.%dG" (x / 1_000_000_000) ((x/1_000_000) mod 1_000_000) if x >= 1_000_000_000 then Printf.sprintf "%d.%dG" (x / 1_000_000_000) ((x/1_000_000) mod 1_000_000)
else if x >= 1_000_000 then Printf.sprintf "%d.%dM" (x / 1_000_000) ((x/1000) mod 1_000) else if x >= 1_000_000 then Printf.sprintf "%d.%dM" (x / 1_000_000) ((x/1000) mod 1_000)
else if x >= 1_000 then Printf.sprintf "%d.%dk" (x/1000) ((x/100) mod 10) else if x >= 1_000 then Printf.sprintf "%d.%dk" (x/1000) ((x/100) mod 100)
else Printf.sprintf "%db" x else Printf.sprintf "%db" x
let header_html = "Content-Type", "text/html" let header_html = "Content-Type", "text/html"