This commit is contained in:
swrup 2025-11-11 02:32:45 +01:00
parent aa2ff7b2f0
commit ab118e0c1e
4 changed files with 27 additions and 18 deletions

View file

@ -1,4 +1,4 @@
version=0.27.0
version=0.28.1
exp-grouping=preserve
type-decl=sparse
break-infix=fit-or-vertical

View file

@ -28,5 +28,14 @@
jsont
cohttp
fmt
bin
angstrom
zarith
mirage-crypto
digestif
duration
jsont
cohttp
ptime
(ocamlformat :with-dev-setup)
))

View file

@ -87,12 +87,12 @@ let supported_lang_arr, supported_ext_arr =
let lang_l =
path_l
|> List.map (fun path ->
match Fpath.segs path with
| [] -> assert false
| [ dir; _file ] -> dir
| _l ->
Fmt.failwith "invalid folder structure, file `%s` is misplaced"
(Fpath.to_string path))
match Fpath.segs path with
| [] -> assert false
| [ dir; _file ] -> dir
| _l ->
Fmt.failwith "invalid folder structure, file `%s` is misplaced"
(Fpath.to_string path))
|> List.sort_uniq String.compare
in
let () =

View file

@ -25,12 +25,12 @@ let select_language headers =
|> Cohttp.Accept.qsort
|> List.map (fun (_q, lang) -> lang)
|> List.map (function
| Cohttp.Accept.AnyLanguage -> Assets.default_lang
| Language language_range -> (
(* ignore language subtags (e.g. "en-US" -> "en") *)
match language_range with
| [] -> assert false
| primary_tag :: _ -> primary_tag))
| Cohttp.Accept.AnyLanguage -> Assets.default_lang
| Language language_range -> (
(* ignore language subtags (e.g. "en-US" -> "en") *)
match language_range with
| [] -> assert false
| primary_tag :: _ -> primary_tag))
|> List.find_opt Assets.is_supported_lang
|> Option.value ~default:Assets.default_lang
@ -40,11 +40,11 @@ let select_encoding headers =
|> Cohttp.Accept.qsort
|> List.map snd
|> List.filter_map (function
| Cohttp.Accept.Identity -> Some `Identity
| Deflate -> Some `DEFLATE
| Gzip -> Some `Gzip
| AnyEncoding -> Some Assets.default_encoding
| Encoding _ | Compress -> (* unsupported *) None)
| Cohttp.Accept.Identity -> Some `Identity
| Deflate -> Some `DEFLATE
| Gzip -> Some `Gzip
| AnyEncoding -> Some Assets.default_encoding
| Encoding _ | Compress -> (* unsupported *) None)
|> function
| [] -> assert false
| `Identity :: _ -> None