From: Stefano Zacchiroli Date: Mon, 24 May 2004 12:45:56 +0000 (+0000) Subject: - ported to latest API X-Git-Tag: V_0_0_9~8 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=2228717a5f41aab3b157713e40753016ad46c2ae;p=helm.git - ported to latest API - bumped copyright info --- diff --git a/helm/DEVEL/ocaml-http/examples/always_ok_daemon.ml b/helm/DEVEL/ocaml-http/examples/always_ok_daemon.ml index 492be655a..d5d456d74 100644 --- a/helm/DEVEL/ocaml-http/examples/always_ok_daemon.ml +++ b/helm/DEVEL/ocaml-http/examples/always_ok_daemon.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 @@ -22,4 +22,5 @@ open Http_daemon;; (* start an http daemon that alway respond with a 200 status code and an empty content *) -start ~port:9999 (fun _ _ outchan -> respond outchan) +start ~port:9999 ~addr:"localhost" (fun _ _ outchan -> respond outchan) + diff --git a/helm/DEVEL/ocaml-http/examples/basic_auth.ml b/helm/DEVEL/ocaml-http/examples/basic_auth.ml index f9d75a7c5..c3e4e6f91 100644 --- a/helm/DEVEL/ocaml-http/examples/basic_auth.ml +++ b/helm/DEVEL/ocaml-http/examples/basic_auth.ml @@ -1,9 +1,29 @@ +(* + OCaml HTTP - do it yourself (fully OCaml) HTTP daemon + + Copyright (C) <2002-2004> 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*) + let callback (req: Http_types.request) outchan = match req#authorization with | Some (`Basic (username, password)) when username = "foo" && password = "bar" -> - Http_daemon.respond ~code:200 ~body:"secret page!" outchan + Http_daemon.respond ~code:(`Code 200) ~body:"secret page!" outchan | _ -> raise (Http_types.Unauthorized "my secret site") let _ = Http_daemon.start' ~port:9999 callback diff --git a/helm/DEVEL/ocaml-http/examples/chdir.ml b/helm/DEVEL/ocaml-http/examples/chdir.ml index a5e460b3a..183b3ca00 100644 --- a/helm/DEVEL/ocaml-http/examples/chdir.ml +++ b/helm/DEVEL/ocaml-http/examples/chdir.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/client_address.ml b/helm/DEVEL/ocaml-http/examples/client_address.ml index 75719111e..0f5c68d2c 100644 --- a/helm/DEVEL/ocaml-http/examples/client_address.ml +++ b/helm/DEVEL/ocaml-http/examples/client_address.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/damned_recursion.ml b/helm/DEVEL/ocaml-http/examples/damned_recursion.ml index dd3f6a36d..8c7efd91e 100644 --- a/helm/DEVEL/ocaml-http/examples/damned_recursion.ml +++ b/helm/DEVEL/ocaml-http/examples/damned_recursion.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/dont_fork.ml b/helm/DEVEL/ocaml-http/examples/dont_fork.ml index d0e1d91e6..f05355496 100644 --- a/helm/DEVEL/ocaml-http/examples/dont_fork.ml +++ b/helm/DEVEL/ocaml-http/examples/dont_fork.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/dump_args.ml b/helm/DEVEL/ocaml-http/examples/dump_args.ml index 8e0d5dc67..a6dcdda0e 100644 --- a/helm/DEVEL/ocaml-http/examples/dump_args.ml +++ b/helm/DEVEL/ocaml-http/examples/dump_args.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 @@ -22,7 +22,7 @@ open Printf;; let callback req outchan = - Http_daemon.send_basic_headers ~code:200 outchan; + Http_daemon.send_basic_headers ~code:(`Code 200) outchan; Http_daemon.send_CRLF outchan; let str = (sprintf "request path = %s\n" req#path) ^ diff --git a/helm/DEVEL/ocaml-http/examples/highlander.ml b/helm/DEVEL/ocaml-http/examples/highlander.ml index b58d3a6e7..24a4abd84 100644 --- a/helm/DEVEL/ocaml-http/examples/highlander.ml +++ b/helm/DEVEL/ocaml-http/examples/highlander.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 @@ -25,7 +25,7 @@ port *) open Printf;; let callback req outchan = - Http_daemon.send_basic_headers ~code:200 outchan; + Http_daemon.send_basic_headers ~code:(`Code 200) outchan; Http_daemon.send_CRLF outchan; let str = (sprintf "request path = %s\n" req#path) ^ diff --git a/helm/DEVEL/ocaml-http/examples/obj_foo.ml b/helm/DEVEL/ocaml-http/examples/obj_foo.ml index 278621853..3a6911019 100644 --- a/helm/DEVEL/ocaml-http/examples/obj_foo.ml +++ b/helm/DEVEL/ocaml-http/examples/obj_foo.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/oo_daemon.ml b/helm/DEVEL/ocaml-http/examples/oo_daemon.ml index b73a2acd9..528f2b246 100644 --- a/helm/DEVEL/ocaml-http/examples/oo_daemon.ml +++ b/helm/DEVEL/ocaml-http/examples/oo_daemon.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/threads.ml b/helm/DEVEL/ocaml-http/examples/threads.ml index 9eba49f37..a73f422d8 100644 --- a/helm/DEVEL/ocaml-http/examples/threads.ml +++ b/helm/DEVEL/ocaml-http/examples/threads.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/timeout.ml b/helm/DEVEL/ocaml-http/examples/timeout.ml index eaa840778..84e989b94 100644 --- a/helm/DEVEL/ocaml-http/examples/timeout.ml +++ b/helm/DEVEL/ocaml-http/examples/timeout.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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 diff --git a/helm/DEVEL/ocaml-http/examples/webfsd.ml b/helm/DEVEL/ocaml-http/examples/webfsd.ml index 6babe3dde..c41443e87 100644 --- a/helm/DEVEL/ocaml-http/examples/webfsd.ml +++ b/helm/DEVEL/ocaml-http/examples/webfsd.ml @@ -2,7 +2,7 @@ (* OCaml HTTP - do it yourself (fully OCaml) HTTP daemon - Copyright (C) <2002> Stefano Zacchiroli + Copyright (C) <2002-2004> 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