HttpsClient

HTTPS client.

Constructors

this
this(Duration timeout)

Constructor.

Members

Functions

adaptConnection
IConnection adaptConnection(IConnection conn)
Undocumented in source. Be warned that the author may not have intended to support it.
connect
void connect(HttpRequest request)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

adapter
SSLAdapter adapter;

SSL context and adapter to use for TLS.

ctx
SSLContext ctx;

SSL context and adapter to use for TLS.

Inherited Members

From HttpClient

connector
Connector connector;
Undocumented in source.
timer
TimeoutAdapter timer;
Undocumented in source.
conn
IConnection conn;
Undocumented in source.
requestQueue
HttpRequest[] requestQueue;
Undocumented in source.
currentResponse
HttpResponse currentResponse;
Undocumented in source.
sentRequests
ulong sentRequests;
receivedResponses
ulong receivedResponses;
Undocumented in source.
headerBuffer
DataVec headerBuffer;
Undocumented in source.
expect
size_t expect;
Undocumented in source.
connect
void connect(HttpRequest request)

Connect to a request's destination.

getNextRequest
HttpRequest getNextRequest()

Pop off a request from the queue and return it, while incrementing sentRequests.

onConnect
void onConnect()

Called when the underlying connection (TCP, TLS...) is established.

onIdle
void onIdle()

Called when we're ready to send a request.

isIdle
bool isIdle()

Returns true when we are connected but not waiting for anything. Requests can always be sent immediately when this is true.

sendRequest
void sendRequest(HttpRequest request)

Encode and send a request (headers and body) to the connection. Has no other side effects.

expectResponse
void expectResponse()

Called to set up the client to be ready to receive a response.

onNewResponse
void onNewResponse(Data data)

Received data handler used while we are receiving headers.

onHeaderData
void onHeaderData(Data[] data)

Called when we've received some data from the response headers.

onHeadersReceived
void onHeadersReceived()

Called when we've read all headers (currentResponse.headers is populated).

onContinuation
void onContinuation(Data data)

Received data handler used while we are receiving the response body.

onData
void onData(Data[] data)

Called when we've received some data from the response body.

onDone
void onDone(Data[] rest, string disconnectReason, bool error)

Called when we've read the entirety of the response. Any left-over data is in rest. disconnectReason is null if there was no disconnect.

finalizeResponse
HttpResponse finalizeResponse()

Wrap up and return the current response, and clean up the client for another request.

submitResponse
void submitResponse(HttpResponse response, string reason)

Submit a received response.

onDisconnect
void onDisconnect(string reason, DisconnectType type)

Disconnect handler

adaptConnection
IConnection adaptConnection(IConnection conn)
Undocumented in source. Be warned that the author may not have intended to support it.
agent
string agent;

User-Agent header to advertise.

keepAlive
bool keepAlive;

Keep connection alive after one request.

pipelining
bool pipelining;

Send requests without waiting for a response. Requires keepAlive.

normalizeRequest
void normalizeRequest(HttpRequest request)

Fix up a response to set up required headers, etc. Done automatically by request, unless called with normalize == false.

request
void request(HttpRequest request, bool normalize)

Send a HTTP request.

connected
bool connected()

Returns true if a connection is active (whether due to an in-flight request or due to keep-alive).

disconnect
void disconnect(string reason)

Close the connection to the HTTP server.

handleResponse
void delegate(HttpResponse response, string disconnectReason) handleResponse;

User-supplied callback for handling the response.

handleDisconnect
void delegate(string disconnectReason, DisconnectType type) handleDisconnect;

Optional disconnect callback. Generally using this only makes sense with a persistent connection with keepAlive=true.

Meta