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
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
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 <name, value> bindings enclosed in request
+ @param clisockaddr client's Unix.sockaddr *)
class request:
path: string -> params: (string * string) list ->
+ clisockaddr: Unix.sockaddr ->
Http_types.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