]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/ocaml-http/examples/dump_args.ml
This commit was manufactured by cvs2svn to create tag 'V_0_0_6'.
[helm.git] / helm / DEVEL / ocaml-http / examples / dump_args.ml
index ba8e4f5ce38b215adcdd68c0dec8108c73a972a4..ef4630fdec715cf86fcbe304a40f4dc49af8cce1 100644 (file)
@@ -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