class type http_call =The container for HTTP callsobject..end
http_call is the runtime container for HTTP method calls. It contains
the request message, the response message, and the current transmission
status.
In previous versions of netclient, this class type was called
message. This was quite inexact because this class embraces both
messages that are part of a call.
Incompatible changes:
using_proxy has been removed. This simply isn't a property of
an individual call.get_req_uri has been removed from the public interface for similar
reasons.Netmime.mime_header and Netmime.mime_body objects. The old
style access methods remain in the API for now. The advantage is
that it is possible to use external files as body containers.`Base and `Effective.method is_served : booltrue if request/response cycle(s) have been finished, i.e. the
call was successful, or a final error state has been reached.method status : statusmethod request_method : stringmethod request_uri : stringmethod set_request_uri : string -> unitmethod request_header : header_kind -> Netmime.mime_header`Base header. After the call has been processed,
the `Effective header contains the version of the header that has
actually been transmitted.
The user should set the following headers:
Content-length: Set this to the length of the request body
if known. (The client falls back to HTTP 1.0 if not set!)Content-type: Set this to the media type of the request bodyExpect: Set this to "100-continue" to enable a handshake before
the body is sent. Recommended for large bodies.DateUser-agentConnectionmethod set_request_header : Netmime.mime_header -> unit`Base header objectmethod effective_request_uri : stringmethod request_body : Netmime.mime_bodymethod set_request_body : Netmime.mime_body -> unit
These method will fail if the call has not yet been served!
If the call has been finished, but was not successful, the
exception Http_protocol is raised.
method response_status_code : intmethod response_status_text : stringmethod response_protocol : stringmethod response_header : Netmime.mime_headerHttp_protocol will be raised.method response_body : Netmime.mime_bodyHttp_protocol will be raised. If the call has succeeded,
but no body has been transmitted, the empty body is substituted.method response_body_storage : response_body_storage`Memory.method set_response_body_storage : response_body_storage -> unitmethod get_reconnect_mode : http_call how_to_reconnectSend_again_if_idem.method set_reconnect_mode : http_call how_to_reconnect -> unitmethod get_redirect_mode : http_call how_to_redirectRedirect_if_idem.method set_redirect_mode : http_call how_to_redirect -> unitmethod proxy_enabled : boolmethod set_proxy_enabled : bool -> unitmethod no_proxy : unit -> unitset_proxy_enabled falsemethod is_proxy_allowed : unit -> boolproxy_enabledThese properties describe the HTTP method
method empty_path_replacement : stringmethod is_idempotent : boolmethod has_req_body : boolmethod has_resp_body : boolmethod same_call : unit -> http_call`UnservedThese method were introduced in previous versions of netclient, but are quite limited. Some questionable methods are now deprecated and will be removed in future versions of netclient.
method get_req_method : unit -> stringrequest_method.method get_host : unit -> stringmethod get_port : unit -> intmethod get_path : unit -> stringmethod get_uri : unit -> stringrequest_uri.method get_req_body : unit -> stringrequest_body # value.method get_req_header : unit -> (string * string) list
In new code, the request_header object should be accessed instead.
method assoc_req_header : string -> stringNot_foundmethod assoc_multi_req_header : string -> string listmethod set_req_header : string -> string -> unitmethod get_resp_header : unit -> (string * string) listmethod assoc_resp_header : string -> stringmethod assoc_multi_resp_header : string -> string listmethod get_resp_body : unit -> string
Otherwise, Http_error (code, body) is raised where 'code' is
the response code and 'body' is the body of the (errorneous)
response.
method dest_status : unit -> string * int * stringmethod private_api : private_api