Constructor.
Connect to a request's destination.
Returns true if a connection is active (whether due to an in-flight request or due to keep-alive).
Close the connection to the HTTP server.
Called to set up the client to be ready to receive a response.
Wrap up and return the current response, and clean up the client for another request.
Pop off a request from the queue and return it, while incrementing sentRequests.
Returns true when we are connected but not waiting for anything. Requests can always be sent immediately when this is true.
Fix up a response to set up required headers, etc. Done automatically by request, unless called with normalize == false.
Called when the underlying connection (TCP, TLS...) is established.
Received data handler used while we are receiving the response body.
Called when we've received some data from the response body.
Disconnect handler
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.
Called when we've received some data from the response headers.
Called when we've read all headers (currentResponse.headers is populated).
Called when we're ready to send a request.
Received data handler used while we are receiving headers.
Send a HTTP request.
Encode and send a request (headers and body) to the connection. Has no other side effects.
Submit a received response.
User-Agent header to advertise.
Optional disconnect callback. Generally using this only makes sense with a persistent connection with keepAlive=true.
User-supplied callback for handling the response.
Keep connection alive after one request.
Send requests without waiting for a response. Requires keepAlive.
Implements a HTTP client connection to a single server.