+ocaml-http (0.1.1+dev) UNRELEASED; urgency=low
+
+ * added ?default parameter to "param" method
+
+ -- Stefano Zacchiroli <zack@debian.org> Wed, 16 Mar 2005 09:24:07 +0100
+
ocaml-http (0.1.0-2) unstable; urgency=low
* rebuilt against ocaml 3.08.3
Section: devel
Priority: optional
Maintainer: Stefano Zacchiroli <zack@debian.org>
-Build-Depends: debhelper (>> 4.0.0), ocaml-nox-3.08.3, ocaml-findlib, libpcre-ocaml-dev (>= 5.08.1-3), libocamlnet-ocaml-dev (>= 0.98.1-2)
+Build-Depends: debhelper (>> 4.0.0), ocaml-nox-3.08.3, ocaml-findlib, libpcre-ocaml-dev (>= 5.08.1-3), libocamlnet-ocaml-dev (>= 1.0-1)
Standards-Version: 3.6.1.1
Package: libhttp-ocaml-dev
Architecture: any
-Depends: ocaml-nox-3.08.3, libpcre-ocaml-dev (>= 5.08.1-3), libocamlnet-ocaml-dev (>= 0.98.1-2)
+Depends: ocaml-nox-3.08.3, libpcre-ocaml-dev (>= 5.08.1-3), libocamlnet-ocaml-dev (>= 1.0-1)
Description: OCaml library for writing HTTP servers
OCaml HTTP is a library for the Objective Caml programming language,
used to build simple HTTP servers, largely inspired to Perl's
method meth = meth
method uri = uri_str
method path = path
- method param ?meth name =
- (match (meth: meth option) with
- | None ->
- (try
- Hashtbl.find params_tbl name
- with Not_found -> raise (Param_not_found name))
- | Some `GET -> List.assoc name query_get_params
- | Some `POST -> List.assoc name query_post_params)
+ method param ?(meth: meth option) ?(default: string option) name =
+ try
+ (match meth with
+ | None -> Hashtbl.find params_tbl name
+ | Some `GET -> List.assoc name query_get_params
+ | Some `POST -> List.assoc name query_post_params)
+ with Not_found ->
+ (match default with
+ | None -> raise (Param_not_found name)
+ | Some value -> value)
method paramAll ?meth name =
(match (meth: meth option) with
| None -> List.rev (Hashtbl.find_all params_tbl name)
method meth: meth
method uri: string
method path: string
- method param: ?meth:meth -> string -> string
+ method param: ?meth:meth -> ?default:string -> string -> string
method paramAll: ?meth:meth -> string -> string list
method params: (string * string) list
method params_GET: (string * string) list
(** lookup a given parameter
@param meth if given restrict the lookup area (e.g. if meth = POST than
- only parameters received via POST are searched), if not given both GET and
- POST parameter are searched in an unspecified order (actually the
- implementation prefers POST parameters but this is not granted, you've
- been warned)
+ only parameters received via POST are searched), if not given both GET
+ and POST parameter are searched in an unspecified order (actually the
+ implementation prefers POST parameters but this is not granted, you've
+ been warned)
+ @param default if provided, this value will be returned in case no
+ parameter of that name is available instead of raising Param_not_found
@param name name of the parameter to lookup
@return value associated to parameter name
@raise Param_not_found if parameter name was not found *)
- method param: ?meth:meth -> string -> string
+ method param: ?meth:meth -> ?default:string -> string -> string
(** like param above but return a list of values associated to given
parameter (a parameter could be defined indeed more than once: passed more