19 #ifndef CORE_NET_HTTP_REQUEST_H_ 20 #define CORE_NET_HTTP_REQUEST_H_ 125 const ProgressHandler& on_progress()
const;
127 Handler& on_progress(
const ProgressHandler& handler);
130 const ResponseHandler& on_response()
const;
132 Handler& on_response(
const ResponseHandler& handler);
135 const ErrorHandler& on_error()
const;
137 Handler& on_error(
const ErrorHandler& handler);
141 ProgressHandler progress_handler{};
142 ResponseHandler response_handler{};
143 ErrorHandler error_handler{};
215 } authentication_handler;
222 bool operator==(
const Request&)
const =
delete;
228 virtual State state() = 0;
234 virtual void set_timeout(
const std::chrono::milliseconds& timeout) = 0;
242 virtual Response execute(
const ProgressHandler& ph) = 0;
249 virtual void async_execute(
const Handler& handler) = 0;
255 virtual std::string url_escape(
const std::string& s) = 0;
261 virtual std::string url_unescape(
const std::string& s) = 0;
272 #endif // CORE_NET_HTTP_REQUEST_H_ The Request class encapsulates a request for a web resource.
Next
The Next enum summarizes the available return-types for the progress callback.
std::function< void(const core::net::Error &)> ErrorHandler
ErrorHandler is invoked in case of errors arising while executing the request.
The Progress struct encapsulates progress information for web-resource requests.
The Errors struct collects the Request-specific exceptions and error modes.
ProgressHandler on_progress
std::function< void(const Response &)> ResponseHandler
ResponseHandler is invoked when a request completes.
The Response struct models a response to a core::net::http::Request.
AuthenicationHandler for_proxy
The Configuration struct encapsulates all options for creating requests.
AlreadyActive is thrown when *execute is called on an active request.
#define CORE_NET_DLL_PUBLIC
ResponseHandler on_response
std::function< Credentials(const std::string &)> AuthenicationHandler
Encapsulates callbacks that can happen during request execution.
static Configuration from_uri_as_string(const std::string &uri)
from_uri_as_string creates a new instance of Configuration for a url.
AuthenicationHandler for_http
The Credentials struct encapsulates username and password for basic & digest authentication.
std::function< Progress::Next(const Progress &)> ProgressHandler
ProgressHandler is invoked for progress updates while executing the request.
State
The State enum describes the different states a request can be in.