Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 120 lines (106 sloc) 4.086 kb
fccc685 Initial open-source release
MLstate authored
1 (*
3098bdc Frederic Ye [enhance] http_client,web_client: more_headers argument is now a string ...
Aqua-Ye authored
2 Copyright © 2011, 2012 MLstate
fccc685 Initial open-source release
MLstate authored
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (*
19 @author Frederic Ye
20 **)
21
22 (**)
23
24 (** The HTTP client name (with version) *)
25 val client_name : string
26
27 (** An exception triggered when the client can reach the server but the server has failed to
28 deliver a complete and parseable reply after a given number of attempts*)
29 exception Timeout
30
31 (** The HTTP client is HTTP/1.0 compatible only
32 Tries a request two times *)
33
34 (** GET function
35 @param async the asynchronous object (from the connection)
36 @param hostname the destination name or ip (warning: sometime
37 destination request with host param. set to their ip instead of their name e.g. www.google.fr)
38 @param port the destination port
39 @param path the destination path (absolute)
40 @param client_certificate the client certificate
41 @param verify_params the verification parameters
42 @param secure use a secure connection (https)
43 @param auth UNDOCUMENTED
44 @param more_headers concatenate more headers in the request
45 @param cont the continuation (fun request_header_map body -> unit)
46
47 @see "Net.ssl_certificate" text
48 @see "Net.ssl_verify_params" text
49 *)
50 val get :
51 Scheduler.t ->
52 string ->
53 int ->
54 string ->
55 ?client_certificate:SslAS.ssl_certificate ->
56 ?verify_params:SslAS.ssl_verify_params ->
57 ?secure:bool ->
58 ?auth:string ->
3098bdc Frederic Ye [enhance] http_client,web_client: more_headers argument is now a string ...
Aqua-Ye authored
59 ?more_headers:string list ->
fccc685 Initial open-source release
MLstate authored
60 ?err_cont:(exn -> unit) ->
61 ?failure:([ `Cannot_parse_response of string | `Timeout | `Unknown_machine of string ] -> unit) ->
62 (Requestdef.Value.value Requestdef.ResponseHeader.t * string -> unit) ->
63 unit
64
65 (** As [get], but with more options*)
66 val place_request :
67 Scheduler.t ->
68 hostname:string ->
69 port:int ->
70 path:string ->
71 ?client_certificate:SslAS.ssl_certificate ->
72 ?verify_params:SslAS.ssl_verify_params ->
73 ?secure:bool ->
74 request_kind:string ->
75 ?auth:string ->
3098bdc Frederic Ye [enhance] http_client,web_client: more_headers argument is now a string ...
Aqua-Ye authored
76 ?more_headers:string list ->
fccc685 Initial open-source release
MLstate authored
77 ?data:string ->
78 ?client_name:string ->
79 ?timeout:Time.t ->
80 ?err_cont:(exn -> unit) ->
81 success:(int * Requestdef.Value.value Requestdef.ResponseHeader.t * string -> unit) ->
82 failure:([`Cannot_parse_response of string | `Unknown_machine of string | `Timeout] -> unit) ->
83 unit ->
84 unit
85
86 (** POST function (uses the get method)
87 @param async the asynchronous object (from the connection)
88 @param hostname the destination name or ip (warning: sometime
89 destination request with host param. set to their ip instead of their name e.g. www.google.fr)
90 @param port the destination port
91 @param path the destination path (absolute)
92 @param client_certificate the client certificate
93 @param verify_params the verification parameters
94 @param secure use a secure connection (https)
95 @param auth UNDOCUMENTED
96 @param mime_type the content type of the request
97 @param length the length of the content. If -1 then will be computed
98 @param data the request body
99 @param cont the continuation (fun request_header_map body -> unit)
100
101 @see "Net.ssl_certificate" text
102 @see "Net.ssl_verify_params" text
103 *)
104 val post :
105 Scheduler.t ->
106 string ->
107 int ->
108 string ->
109 ?client_certificate:SslAS.ssl_certificate ->
110 ?verify_params:SslAS.ssl_verify_params ->
111 ?secure:bool ->
112 ?auth:string ->
113 string ->
114 ?length:int ->
115 ?err_cont:(exn -> unit) ->
116 ?failure:([ `Cannot_parse_response of string | `Timeout | `Unknown_machine of string ] -> unit) ->
117 string ->
118 (Requestdef.Value.value Requestdef.ResponseHeader.t * string -> unit) ->
119 unit
Something went wrong with that request. Please try again.