X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fhttp_getter%2Fhttp_getter.ml;h=02877b012c55690222fb7c2a87763225706f82bd;hb=21a69c0525553c5e197ca0499705afe904fd7260;hp=1e04ae8789ac06bab757c1b45398d7947cc2a3c3;hpb=2e41357d3d5cca73b3f91e83528d3758ca3e62db;p=helm.git diff --git a/helm/http_getter/http_getter.ml b/helm/http_getter/http_getter.ml index 1e04ae878..02877b012 100644 --- a/helm/http_getter/http_getter.ml +++ b/helm/http_getter/http_getter.ml @@ -30,6 +30,14 @@ open Http_getter_types;; 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) = @@ -80,7 +88,12 @@ let map_of_uri = function | 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 @@ -88,6 +101,7 @@ let return_all_foo_uris map doctype filter outchan = *) 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 @@ -181,7 +195,8 @@ let return_ls = 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 @@ -214,7 +229,8 @@ let return_ls = 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,