X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fdaemons%2Fhttp_getter%2Fmain.ml;h=f708dc529f54f9f76564d55dcd031a5b7ebdc05e;hb=d8bc6fd4ab18f2995624c75e2889318237e9c17f;hp=3117a85c991eed1be6c3cf81d14d2048cfe45683;hpb=76ad23ea1e83e8c187a4593027e9baed1bb022e3;p=helm.git
diff --git a/helm/software/daemons/http_getter/main.ml b/helm/software/daemons/http_getter/main.ml
index 3117a85c9..f708dc529 100644
--- a/helm/software/daemons/http_getter/main.ml
+++ b/helm/software/daemons/http_getter/main.ml
@@ -147,7 +147,7 @@ let return_all_xml_uris fmt outchan =
| `Xml -> return_all_uris "alluris" uris outchan
let return_ls regexp fmt outchan =
- let ls_items = Http_getter.ls regexp in
+ let ls_items = Http_getter.ls ~local:false regexp in
let buf = Buffer.create 10240 in
(match fmt with
| `Text ->
@@ -191,10 +191,11 @@ let return_ls regexp fmt outchan =
let return_help outchan = return_html_raw (Http_getter.help ()) outchan
-let return_resolve uri outchan =
+let return_resolve writable uri outchan =
try
return_xml_raw
- (sprintf "\n" (Http_getter.resolve uri))
+ (sprintf "\n"
+ (Http_getter.resolve ~writable ~local:false uri))
outchan
with
| Unresolvable_URI _ -> return_xml_raw "\n" outchan
@@ -272,7 +273,10 @@ let callback (req: Http_types.request) outchan =
| "/getxml" ->
let uri = req#param "uri" in
let fname = Http_getter.getxml uri in (* local name, in cache *)
- let remote_name = Http_getter.resolve uri in (* remote name *)
+ (* remote name *)
+ let remote_name =
+ Http_getter.resolve ~writable:false ~local:false uri
+ in
let src_enc = if is_gzip fname then `Gzipped else `Normal in
let enc = parse_enc req in
let fname, cleanup = convert_file ~from_enc:src_enc ~to_enc:enc fname in
@@ -293,7 +297,13 @@ let callback (req: Http_types.request) outchan =
| "/getdtd" ->
let fname = Http_getter.getdtd (req#param "uri") in
respond_dtd (parse_patch req) fname outchan
- | "/resolve" -> return_resolve (req#param "uri") outchan
+ | "/resolve" ->
+ let writable =
+ match req#param ~default:"false" "writable" with
+ | "true" -> true
+ | _ -> false
+ in
+ return_resolve writable (req#param "uri") outchan
| "/clean_cache" ->
Http_getter.clean_cache ();
return_html_msg "Done." outchan
@@ -342,6 +352,7 @@ let main () =
let d_spec = Http_daemon.daemon_spec
~mode:`Thread ~timeout:(Some 600)
~port:(Lazy.force Http_getter_env.port)
+ ~auto_close:true
~callback:callback ()
in
try