X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fdaemons%2Fhttp_getter%2Fmain.ml;h=199a8b463f5920e66eaee3ff8681b12a1b494e73;hb=bb505b355287b664c3c0ef92781700fc0cc5d281;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..199a8b463 100644
--- a/helm/software/daemons/http_getter/main.ml
+++ b/helm/software/daemons/http_getter/main.ml
@@ -191,10 +191,10 @@ 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 uri))
outchan
with
| Unresolvable_URI _ -> return_xml_raw "\n" outchan
@@ -272,7 +272,8 @@ 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 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 +294,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 +349,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