1 (** Wrapper around Perl [HTTP::Request::Common] class.
3 * Copyright (C) 2003 Merjis Ltd.
5 * $Id: pl_HTTP_Request_Common.ml,v 1.1 2004-11-22 17:08:36 rich Exp $
12 let _ = eval "use HTTP::Request::Common"
15 let dofn fn url headers =
18 List.fold_right (fun (k, v) rest ->
19 sv_of_string k :: sv_of_string v :: rest)
21 new http_request (call ~fn args)
23 let get = dofn "GET" in
24 let head = dofn "HEAD" in
25 let put = dofn "PUT" in
28 let post url ?form headers =
29 let hv = hv_empty () in
32 | Some xs -> List.iter (fun (k, v) -> hv_set hv k (sv_of_string v)) xs);
34 sv_of_string url :: hashref hv ::
35 List.fold_right (fun (k, v) rest ->
36 sv_of_string k :: sv_of_string v :: rest)
38 new http_request (call ~fn:"POST" args)