X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=DEVEL%2Focaml-http%2Fhttp_daemon.ml;h=992f3b99a8dc9a8bcf2ea31c19b2c05cfbd30f5f;hb=2f857bf7f4d1bb73d08d270af9d7ad36a365a3c4;hp=2457c8a7337587336cda7603e4086f7d7ea47a15;hpb=e8ca5a22b5e7174c27f1855c2687798544e2103e;p=helm.git diff --git a/DEVEL/ocaml-http/http_daemon.ml b/DEVEL/ocaml-http/http_daemon.ml index 2457c8a73..992f3b99a 100644 --- a/DEVEL/ocaml-http/http_daemon.ml +++ b/DEVEL/ocaml-http/http_daemon.ml @@ -303,7 +303,15 @@ let invoke_callback req spec outchan = let callback req outchan = if spec.auto_close then Http_misc.finally - (fun () -> try close_out outchan with Sys_error _ -> ()) + (fun () -> + (* XXX the pair flush + shutdown is a temporary solution since double + * close on a socket make ocaml 3.09.2 segfault (see + * http://caml.inria.fr/mantis/view.php?id=4059). The right thing to + * do is probably invoke try_close outchan here *) + flush outchan; + try + Unix.shutdown (Unix.descr_of_out_channel outchan) Unix.SHUTDOWN_ALL + with Unix.Unix_error(_, "shutdown", "") -> ()) (fun () -> spec.callback req outchan) () else spec.callback req outchan in @@ -454,6 +462,7 @@ let daemon_spec { default_spec with address = address; auth = auth; + auto_close = auto_close; callback = callback; mode = mode; port = port;