mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-05 19:00:32 -05:00
wip
This commit is contained in:
parent
0078d91672
commit
10ade90dfd
2 changed files with 39 additions and 0 deletions
|
|
@ -277,3 +277,26 @@ let add_vfs ~config ~vfs ~prefix server : unit =
|
|||
|
||||
let add_dir_path ~config ~dir ~prefix server : unit =
|
||||
add_vfs_ ~on_fs:true ~top:dir ~config ~prefix ~vfs:(vfs_of_dir dir) server
|
||||
|
||||
module Embedded_fs = struct
|
||||
module Str_tbl = Hashtbl.Make(struct
|
||||
include String
|
||||
let hash = Hashtbl.hash
|
||||
end)
|
||||
|
||||
type t = {
|
||||
entries: entry Str_tbl.t
|
||||
} [@@unboxed]
|
||||
|
||||
and entry =
|
||||
| File of {
|
||||
content: string;
|
||||
}
|
||||
| Dir of t
|
||||
|
||||
(* TODO: the rest *)
|
||||
(* TODO: use util.split_on_slash *)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -130,3 +130,19 @@ val add_vfs :
|
|||
@since NEXT_RELEASE
|
||||
*)
|
||||
|
||||
(** An embedded file system, as a list of files with (relative) paths.
|
||||
This is useful in combination with the "tiny-httpd-mkfs" tool,
|
||||
which embeds the files it's given into a OCaml module.
|
||||
|
||||
@since NEXT_RELEASE
|
||||
*)
|
||||
module Embedded_fs : sig
|
||||
type t
|
||||
(** The pseudo-filesystem *)
|
||||
|
||||
val create : unit -> t
|
||||
|
||||
val add_file : t -> path:string -> string -> unit
|
||||
|
||||
val to_vfs : t -> (module VFS)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue