patch #7262
[mldonkey.git] / src / utils / net / http_client.mli
blobfdb568ddb997f4fcb36a8172b2c65e71ffb049ab
1 (* Copyright 2002 b8_bavard, b8_fee_carabine, INRIA *)
2 (*
3 This file is part of mldonkey.
5 mldonkey is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 mldonkey is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mldonkey; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 type http_request =
21 GET
22 | POST
23 | HEAD
24 | PUT
25 | DELETE
26 | TRACE
29 | OPTIONS of url option (* None = '*' *)
30 | CONNECT of string * int
32 val verbose : bool ref
34 type request = {
35 req_headers : ( string * string ) list;
36 req_user_agent : string;
37 req_accept : string;
38 req_proxy : (string * int) option;
39 mutable req_url : Url.url;
40 mutable req_save_to_file_time : float;
41 (* re-download a saved file only if newer *)
42 req_request : http_request;
43 req_referer : Url.url option;
44 req_retry : int;
45 req_max_retry : int;
46 req_save : bool;
47 (** maximum time whole request processing is allowed to take, in seconds *)
48 req_max_total_time : float;
51 type content_handler =
52 int64 -> (string * string) list -> TcpBufferedSocket.t -> int -> unit
54 val basic_request : request
56 val get_page : request -> content_handler -> (unit -> unit) -> (int -> unit) -> unit
57 val wget : request -> (string -> unit) -> unit
58 val whead : request -> ( (string * string) list -> unit) -> unit
59 val whead2 : request -> ( (string * string) list -> unit) -> (int -> unit) -> unit
61 val wget_string : request -> (string -> unit) -> ?ferr:(int -> unit) ->
62 (int -> int64 -> unit) -> unit
67 val default_headers_handler : (int -> TcpBufferedSocket.t -> int -> unit) ->
68 headers_handler
71 val split_header : string -> string list
72 val cut_headers : string list -> (string * (string * string)) list