]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/ocaml-http/http_user_agent.mli
ocaml 3.09 transition
[helm.git] / helm / DEVEL / ocaml-http / http_user_agent.mli
1
2 (*
3   OCaml HTTP - do it yourself (fully OCaml) HTTP daemon
4
5   Copyright (C) <2002-2005> Stefano Zacchiroli <zack@cs.unibo.it>
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU Library General Public License as
9   published by the Free Software Foundation, version 2.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU Library General Public License for more details.
15
16   You should have received a copy of the GNU Library General Public
17   License along with this program; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   USA
20 *)
21
22 (** Minimal implementation of an HTTP 1.0/1.1 client. Interface is similar to
23  * Gerd Stoplmann's Http_client module. Implementation is simpler and doesn't
24  * handle HTTP redirection, proxies, ecc. The only reason for the existence of
25  * this module is for performances and incremental elaboration of response's
26  * bodies *)
27
28 open Http_types
29
30 exception Http_error of (int * string)  (* code, body *)
31
32   (** @param head_callback optional calllback invoked on response's status and
33    * headers. If not provided no callback will be invoked
34    * @param url an HTTP url
35    * @return HTTP response's body
36    * @raise Http_error when response code <> 200 *)
37 val get:
38   ?head_callback:(status -> (string * string) list -> unit) ->
39   string ->
40     string
41
42   (** as above but iter callback function on HTTP response's body instead of
43    * returning it as a string *)
44 val get_iter:
45   ?head_callback:(status -> (string * string) list -> unit) ->
46   (string -> unit) -> string ->
47     unit
48
49   (** @param url an HTTP url
50    * @return HTTP HEAD raw response
51    * @raise Http_error when response code <> 200 *)
52 val head: string -> string
53