3 OCaml HTTP - do it yourself (fully OCaml) HTTP daemon
5 Copyright (C) <2002-2005> Stefano Zacchiroli <zack@cs.unibo.it>
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.
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.
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
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
30 exception Http_error of (int * string) (* code, body *)
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 *)
38 ?head_callback:(status -> (string * string) list -> unit) ->
42 (** as above but iter callback function on HTTP response's body instead of
43 * returning it as a string *)
45 ?head_callback:(status -> (string * string) list -> unit) ->
46 (string -> unit) -> string ->
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