From 28094cb186c862ac29f95e32f146ebaa59becb5a Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Mon, 9 Dec 2002 14:58:24 +0000 Subject: [PATCH] - added methods to retrieve client IP address related info --- helm/DEVEL/ocaml-http/http_request.ml | 6 +++++- helm/DEVEL/ocaml-http/http_request.mli | 6 +++++- helm/DEVEL/ocaml-http/http_types.ml | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/helm/DEVEL/ocaml-http/http_request.ml b/helm/DEVEL/ocaml-http/http_request.ml index 4eec70279..c135c95b3 100644 --- a/helm/DEVEL/ocaml-http/http_request.ml +++ b/helm/DEVEL/ocaml-http/http_request.ml @@ -22,7 +22,8 @@ open Http_common;; open Http_types;; -class request ~path ~params = +class request ~path ~params ~clisockaddr = + let (addr, port) = Http_misc.explode_sockaddr clisockaddr in object (self) val params_tbl = let tbl = Hashtbl.create (List.length params) in @@ -40,5 +41,8 @@ class request ~path ~params = raise (Param_not_found name) method paramAll name = List.rev (Hashtbl.find_all params_tbl name) method params = params + method clientSockaddr = clisockaddr + method clientAddr = addr + method clientPort = port end diff --git a/helm/DEVEL/ocaml-http/http_request.mli b/helm/DEVEL/ocaml-http/http_request.mli index 2b603c787..8cc223444 100644 --- a/helm/DEVEL/ocaml-http/http_request.mli +++ b/helm/DEVEL/ocaml-http/http_request.mli @@ -19,8 +19,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) - (** fooish class to enclose callback's arguments *) + (** OO representation of an HTTP request + @param path path requested by client + @param params list of bindings enclosed in request + @param clisockaddr client's Unix.sockaddr *) class request: path: string -> params: (string * string) list -> + clisockaddr: Unix.sockaddr -> Http_types.request diff --git a/helm/DEVEL/ocaml-http/http_types.ml b/helm/DEVEL/ocaml-http/http_types.ml index ebbcbcc35..fa09a3d5c 100644 --- a/helm/DEVEL/ocaml-http/http_types.ml +++ b/helm/DEVEL/ocaml-http/http_types.ml @@ -179,6 +179,9 @@ class type request = method param: string -> string method paramAll: string -> string list method params: (string * string) list + method clientSockaddr: Unix.sockaddr + method clientAddr: string + method clientPort: int end class type connection = object -- 2.39.2