1#ifndef LIBFILEZILLA_HTTP_CLIENT_HEADER
2#define LIBFILEZILLA_HTTP_CLIENT_HEADER
20namespace http::client {
31 uint64_t request_id_{};
34template<
class Request,
class Response>
38 virtual request & req()
override {
return request_; }
39 virtual response & res()
override {
return response_; }
49 response_.on_header_ = [cb = std::move(cb)](shared_request_response
const& srr) {
50 auto p = std::static_pointer_cast<request_response_holder<Request, Response>>(srr);
55 response_.on_header_ =
nullptr;
67 request_.on_body_sending_progress_ = [cb = std::move(cb)](shared_request_response
const& srr,
size_t c) {
68 auto p = std::static_pointer_cast<request_response_holder<Request, Response>>(srr);
73 request_.on_body_sending_progress_ =
nullptr;
80typedef std::shared_ptr<request_response_interface> shared_request_response;
83struct done_event_type;
102 bool add_request(shared_request_response
const& srr);
135 std::unique_ptr<impl> impl_;
A buffer pool for use with async readers/writers.
Definition aio.hpp:107
Definition event_handler.hpp:63
void stop(bool keep_alive)
Stops the client, deletes all requests.
client(event_handler &handler, aio_buffer_pool &buffer_pool, logger_interface &logger, std::string user_agent)
A buffer pool is optional. If no pool is given, writers cannot be used in responses.
virtual socket_interface * create_socket(native_string const &host, unsigned short port, bool tls)=0
Called when the client requests a new socket.
virtual void destroy_socket()=0
Called when the client no longer needs the socket.
virtual void on_alive()
Definition client.hpp:125
void set_on_header(std::function< continuation(std::shared_ptr< request_response_holder< Request, Response > > const &)> cb)
Definition client.hpp:46
void set_body_sending_progress(std::function< void(std::shared_ptr< request_response_holder< Request, Response > > const &, size_t)> cb)
Definition client.hpp:64
Used for type erasure, so the internals don't need to know the full request/response.
Definition client.hpp:24
A single HTTP request to be sent by the client.
Definition client_request.hpp:19
A single HTTP response received by the client.
Definition client_response.hpp:22
Abstract interface for logging strings.
Definition logger.hpp:51
This is the recommended event class.
Definition event.hpp:68
Interface for sockets.
Definition socket.hpp:375
simple_event< done_event_type, uint64_t, bool > done_event
Definition client.hpp:87
HTTP requests, client-side view.
HTTP responses, client-side view.
The namespace used by libfilezilla.
Definition apply.hpp:17
std::wstring native_string
A string in the system's native character type and encoding. Note: This typedef changes depending on...
Definition string.hpp:69
String types and assorted functions.