X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Focaml-http%2Fexamples%2Fdump_args.ml;h=ef4630fdec715cf86fcbe304a40f4dc49af8cce1;hb=refs%2Ftags%2FV_0_0_6;hp=ba8e4f5ce38b215adcdd68c0dec8108c73a972a4;hpb=2f28bfb47f5fad6b3c5a705d9ede95700416dee8;p=helm.git diff --git a/helm/DEVEL/ocaml-http/examples/dump_args.ml b/helm/DEVEL/ocaml-http/examples/dump_args.ml index ba8e4f5ce..ef4630fde 100644 --- a/helm/DEVEL/ocaml-http/examples/dump_args.ml +++ b/helm/DEVEL/ocaml-http/examples/dump_args.ml @@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) +open Printf;; + let dump_args path args = Printf.sprintf "PATH: %s\nARGS:\n%s" @@ -26,24 +28,24 @@ let dump_args path args = (String.concat "" (List.map - (fun (name, value) -> "\tNAME: " ^ name ^ ", VALUE: " ^ value ^ "\n") + (fun (name, value) -> sprintf "\tNAME: '%s', VALUE: '%s'\n" name value) args)) in let callback path args outchan = match path with | "/gone" -> - Http.Daemon.respond_redirect + Http_daemon.respond_redirect ~location:"/foo" ~body:"REDIRECT" ~code:302 outchan | "/error" -> - Http.Daemon.respond_error ~body:"ERROR" ~code:500 outchan + Http_daemon.respond_error ~body:"ERROR" ~code:500 outchan | _ -> begin - Http.Daemon.send_basic_headers ~code:200 outchan; - Http.Daemon.send_CRLF outchan; + Http_daemon.send_basic_headers ~code:200 outchan; + Http_daemon.send_CRLF outchan; output_string outchan (dump_args path args) end in -print_endline "Starting custom Http.Daemon ..."; +print_endline "Starting custom Http_daemon ..."; flush stdout; -Http.Daemon.start ~addr:"127.0.0.1" ~port:9999 callback +Http_daemon.start ~port:9999 callback