X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2FDEVEL%2Focaml-http%2Fexamples%2Fdump_args.ml;h=e8a66a57fb64812e2c9302aceaa45573f43904a0;hb=e42a9a3eabac1d284a37a8f5e22d6e73b0dc887f;hp=ab082112aca95e554a1a67ac4a9442059fa137a5;hpb=d43522a6d38fcb9081a3f0352088377bc0555231;p=helm.git diff --git a/helm/software/DEVEL/ocaml-http/examples/dump_args.ml b/helm/software/DEVEL/ocaml-http/examples/dump_args.ml index ab082112a..e8a66a57f 100644 --- a/helm/software/DEVEL/ocaml-http/examples/dump_args.ml +++ b/helm/software/DEVEL/ocaml-http/examples/dump_args.ml @@ -1,8 +1,7 @@ - (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002-2004> Stefano Zacchiroli + Copyright (C) <2002-2007> Stefano Zacchiroli This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,6 +33,16 @@ let callback req outchan = (sprintf "request ALL params = %s\n" (String.concat ";" (List.map (fun (h,v) -> String.concat "=" [h;v]) req#params))) ^ + (sprintf "cookies = %s\n" + (match req#cookies with + | None -> + "NO COOKIES " + ^ (if req#hasHeader ~name:"cookie" + then "('Cookie:' header was '" ^ req#header ~name:"cookie" ^ "')" + else "(No 'Cookie:' header received)") + | Some cookies -> + (String.concat ";" + (List.map (fun (n,v) -> String.concat "=" [n;v]) cookies)))) ^ (sprintf "request BODY = '%s'\n\n" req#body) in Http_daemon.respond ~code:(`Code 200) ~body: str outchan