18 #ifndef CORE_NET_HTTP_REQUEST_H_ 19 #define CORE_NET_HTTP_REQUEST_H_ 124 const ProgressHandler& on_progress()
const;
126 Handler& on_progress(
const ProgressHandler& handler);
129 const ResponseHandler& on_response()
const;
131 Handler& on_response(
const ResponseHandler& handler);
134 const ErrorHandler& on_error()
const;
136 Handler& on_error(
const ErrorHandler& handler);
140 ProgressHandler progress_handler{};
141 ResponseHandler response_handler{};
142 ErrorHandler error_handler{};
214 } authentication_handler;
221 bool operator==(
const Request&)
const =
delete;
227 virtual State state() = 0;
233 virtual void set_timeout(
const std::chrono::milliseconds& timeout) = 0;
241 virtual Response execute(
const ProgressHandler& ph) = 0;
248 virtual void async_execute(
const Handler& handler) = 0;
254 virtual std::string url_escape(
const std::string& s) = 0;
260 virtual std::string url_unescape(
const std::string& s) = 0;
271 #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.