open Http_getter_debugger;;
open Printf;;
+ (* constants *)
+
+let common_headers = [
+ "Cache-Control", "no-cache";
+ "Pragma", "no-cache";
+ "Expires", "0"
+]
+
(* HTTP queries argument parsing *)
let parse_enc (req: Http_types.request) =
| uri when is_xsl_uri uri -> xsl_map
| uri -> raise (Http_getter_unresolvable_URI uri)
in
-let resolve uri = (map_of_uri uri)#resolve uri in
+let resolve uri =
+ try
+ (map_of_uri uri)#resolve uri
+ with Http_getter_map.Key_not_found _ ->
+ raise (Http_getter_unresolvable_URI uri)
+in
let register uri = (map_of_uri uri )#add uri in
let return_all_foo_uris map doctype filter outchan =
(** return all URIs contained in 'map' which satisfy predicate 'filter'; URIs
*)
Http_daemon.send_basic_headers ~code:200 outchan;
Http_daemon.send_header "Content-Type" "text/xml" outchan;
+ Http_daemon.send_headers common_headers outchan;
Http_daemon.send_CRLF outchan;
output_string
outchan
objs "")
in
Http_daemon.respond
- ~headers:["Content-Type", "text/plain"] ~body outchan
+ ~headers:(("Content-Type", "text/plain") :: common_headers)
+ ~body outchan
| Fmt_xml ->
let body =
sprintf
objs ""))
in
Http_daemon.respond
- ~headers:["Content-Type", "text/xml"] ~body outchan
+ ~headers:(("Content-Type", "text/xml") :: common_headers)
+ ~body outchan
in
let (index_line_sep_RE, index_sep_RE, trailing_types_RE,
heading_cic_RE, heading_theory_RE,