This module provides the API to an HTTP/1.1 compatible client according
to
When starting the
If the scheme
Pipelining is only used if the pipeline time-out is set, otherwise persistent connections without pipelining are used. That is, the client always waits for the previous response before sending the next request.
Some examples are provided in the
Type definitions that are used more than once in this module:
Type definitions related to HTTP:
=
|
=
|
|
For more information about HTTP, see
See
An HTTP client can be configured to start when starting the
Name of the profile, see
Directory where the profile can save persistent data. If omitted, all cookies are treated as session cookies.
The client can be stopped using
Cancels an asynchronous HTTP request. Notice that this does not guarantee that the request response is not delivered. Because it is asynchronous, the request can already have been completed when the cancellation arrives.
Returns the cookie header that would have been sent
when making a request to
Option
Retrieves the options currently used by the client.
Produces a list of miscellaneous information. Intended for debugging. If no profile is specified, the default profile is used.
Resets (clears) the cookie database for the specified
Equivalent to
Sends an HTTP request. The function can be both synchronous
and asynchronous. In the latter case, the function returns
HTTP option (
Time-out time for the request.
The clock starts ticking when the request is sent.
Time is in milliseconds.
Default is
Connection time-out time, used during the initial request, when the client is connecting to the server.
Time is in milliseconds.
Default is the value of option
This is the
Defaults to
The client automatically retrieves the information from the new URI and returns that as the result, instead of a 30X-result code.
For some 30X-result codes, automatic redirect is not allowed. In these cases the 30X-result is always returned.
Default is
A proxy-authorization header using the provided username and password is added to the request.
Can be used to make the client act as an
Default is the string
If set to
Default is
Option (
Option for the request to be synchronous or asynchronous.
Default is
Streams the body of a 200 or 206 response to the calling
process or to a file. When streaming to the calling process
using option
When streaming to the calling processes using option
Notice that chunked encoding can add
headers so that there are more headers in the
Default is
Defines if the body is to be delivered as a string or binary. This option is only valid for the synchronous request.
Default is
Defines if a "full result" is to be returned to the caller (that is, the body, the headers, and the entire status line) or not (the body and the status code).
Default is
Defines if the headers provided by the user are to be made lower case or to be regarded as case sensitive.
The HTTP standard requires them to be case insensitive. Use this feature only if there is no other way to communicate with the server or for testing purpose. When this option is used, no headers are automatically added. All necessary headers must be provided by the user.
Default is
Socket options to be used for this and subsequent requests.
Overrides any value set by function
The validity of the options is not checked by the HTTP client they are assumed to be correct and passed on to ssl application and inet driver, which may reject them if they are not correct. Note that the current implementation assumes the requests to the same host, port combination will use the same socket options.
By default the socket options set by function
Defines how the client delivers the result of an
asynchronous request (
Messages are sent to this process in the format
Information is delivered to the receiver through calls
to the provided fun
Information is delivered to the receiver through calls
to the callback function
In all of these cases,
{RequestId, saved_to_file} {RequestId, {error, Reason}} {RequestId, Result} {RequestId, stream_start, Headers} {RequestId, stream_start, Headers, HandlerPid} {RequestId, stream, BinBodyPart} {RequestId, stream_end, Headers}
Default is the
Defines when parsing the Host-Port part of an URI with an IPv6 address
with brackets, if those brackets are to be retained (
Default is
Sets options to be used for subsequent requests.
If possible, the client keeps its connections alive and uses persistent connections with or without pipeline depending on configuration and current circumstances. The HTTP/1.1 specification does not provide a guideline for how many requests that are ideal to be sent on a persistent connection. This depends much on the application.
A long queue of requests can cause a
user-perceived delay, as earlier requests can take a long time
to complete. The HTTP/1.1 specification suggests a
limit of two persistent connections per server, which is the
default value of option
Saves the cookies defined in
Triggers the next message to be streamed, that is, the same behavior as active ones for sockets.
Produces a list of the entire cookie database. Intended for debugging/testing purposes. If no profile is specified, the default profile is used.
Produces a slightly processed dump of the session database. It is intended for debugging. If no profile is specified, the default profile is used.