Skip to content
This repository
tag: v1164
Fetching contributors…

Cannot retrieve contributors at this time

file 119 lines (106 sloc) 4.07 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
(*
@author Frederic Ye
**)

(**)

(** The HTTP client name (with version) *)
val client_name : string

(** An exception triggered when the client can reach the server but the server has failed to
deliver a complete and parseable reply after a given number of attempts*)
exception Timeout

(** The HTTP client is HTTP/1.0 compatible only
Tries a request two times *)

(** GET function
@param async the asynchronous object (from the connection)
@param hostname the destination name or ip (warning: sometime
destination request with host param. set to their ip instead of their name e.g. www.google.fr)
@param port the destination port
@param path the destination path (absolute)
@param client_certificate the client certificate
@param verify_params the verification parameters
@param secure use a secure connection (https)
@param auth UNDOCUMENTED
@param more_headers concatenate more headers in the request
@param cont the continuation (fun request_header_map body -> unit)

@see "Net.ssl_certificate" text
@see "Net.ssl_verify_params" text
*)
val get :
  Scheduler.t ->
  string ->
  int ->
  string ->
  ?client_certificate:SslAS.ssl_certificate ->
  ?verify_params:SslAS.ssl_verify_params ->
  ?secure:bool ->
  ?auth:string ->
  ?more_headers:string ->
  ?err_cont:(exn -> unit) ->
  ?failure:([ `Cannot_parse_response of string | `Timeout | `Unknown_machine of string ] -> unit) ->
  (Requestdef.Value.value Requestdef.ResponseHeader.t * string -> unit) ->
  unit

(** As [get], but with more options*)
val place_request :
  Scheduler.t ->
  hostname:string ->
  port:int ->
  path:string ->
  ?client_certificate:SslAS.ssl_certificate ->
  ?verify_params:SslAS.ssl_verify_params ->
  ?secure:bool ->
  request_kind:string ->
  ?auth:string ->
  ?more_headers:string ->
  ?data:string ->
  ?client_name:string ->
  ?timeout:Time.t ->
  ?err_cont:(exn -> unit) ->
  success:(int * Requestdef.Value.value Requestdef.ResponseHeader.t * string -> unit) ->
  failure:([`Cannot_parse_response of string | `Unknown_machine of string | `Timeout] -> unit) ->
  unit ->
  unit

(** POST function (uses the get method)
@param async the asynchronous object (from the connection)
@param hostname the destination name or ip (warning: sometime
destination request with host param. set to their ip instead of their name e.g. www.google.fr)
@param port the destination port
@param path the destination path (absolute)
@param client_certificate the client certificate
@param verify_params the verification parameters
@param secure use a secure connection (https)
@param auth UNDOCUMENTED
@param mime_type the content type of the request
@param length the length of the content. If -1 then will be computed
@param data the request body
@param cont the continuation (fun request_header_map body -> unit)

@see "Net.ssl_certificate" text
@see "Net.ssl_verify_params" text
*)
val post :
  Scheduler.t ->
  string ->
  int ->
  string ->
  ?client_certificate:SslAS.ssl_certificate ->
  ?verify_params:SslAS.ssl_verify_params ->
  ?secure:bool ->
  ?auth:string ->
  string ->
  ?length:int ->
  ?err_cont:(exn -> unit) ->
  ?failure:([ `Cannot_parse_response of string | `Timeout | `Unknown_machine of string ] -> unit) ->
  string ->
  (Requestdef.Value.value Requestdef.ResponseHeader.t * string -> unit) ->
  unit
Something went wrong with that request. Please try again.