if remote () then
getdtd_remote uri
else begin
- let fname = Lazy.force Http_getter_env.dtd_dir ^ "/" ^ uri in
+ let fname = Http_getter_env.get_dtd_dir () ^ "/" ^ uri in
if not (Sys.file_exists fname) then raise (Dtd_not_found uri);
fname
end
sprintf "%s $1 SYSTEM \"%s/getdtd?uri=" kind
(Lazy.force Http_getter_env.my_own_url)
else
- sprintf "%s $1 SYSTEM \"file://%s/" kind
- (Lazy.force Http_getter_env.dtd_dir)
+ sprintf "%s $1 SYSTEM \"file://%s/" kind (Http_getter_env.get_dtd_dir ())
in
fun line -> Pcre.replace ~rex ~templ line
let prefix_RE = Pcre.regexp "^\\s*([^\\s]+)\\s+([^\\s]+)\\s*(.*)$"
let cache_dir = lazy (normalize_dir (Helm_registry.get "getter.cache_dir"))
-let dtd_dir = lazy (normalize_dir (Helm_registry.get "getter.dtd_dir"))
+let dtd_dir = lazy (
+ match Helm_registry.get_opt Helm_registry.get_string "getter.dtd_dir" with
+ | None -> None
+ | Some dir -> Some (normalize_dir dir))
let dtd_base_urls = lazy (
let rex = Pcre.regexp "/*$" in
let raw_urls =
"
version
(pp_prefixes (Lazy.force prefixes))
- (Lazy.force dtd_dir) (Lazy.force host) (Lazy.force port)
+ (match Lazy.force dtd_dir with Some dir -> dir | None -> "NONE")
+ (Lazy.force host) (Lazy.force port)
(Lazy.force my_own_url) (String.concat " " (Lazy.force dtd_base_urls))
(match Http_getter_logger.get_log_file () with None -> "None" | Some f -> f)
(Http_getter_logger.get_log_level ())
+let get_dtd_dir () =
+ match Lazy.force dtd_dir with
+ | None -> raise (Internal_error "dtd_dir is not available")
+ | Some dtd_dir -> dtd_dir
+
(** all *_dir values are returned with trailing "/" *)
val cache_dir : string lazy_t (* cache root *)
-val dtd_dir : string lazy_t (* DTDs' root directory *)
+val dtd_dir : string option lazy_t (* DTDs' root directory *)
val port : int lazy_t (* port on which getter listens *)
val dtd_base_urls : string list lazy_t (* base URLs for document patching *)
val prefixes : (string * (string * prefix_attr list)) list lazy_t
current http_getter settings on an output
channel *)
+val get_dtd_dir : unit -> string
+