class
#include <IO/WebRequest.h>
WebRequestBase Base class of web requests.
Derived classes
- class WebRequest
- Represents web request.
- class WebRequestAsync
- Represents asynchronous web request.
Public types
- struct Result
- Result of synchronous operation.
- enum class State { Idle, Unauthorized, Active, Completed, Failed, Cancelled }
- Request state.
- enum class Storage { Memory, File, None }
- Storage for response data.
- enum class Ignore { None = 0, Certificate = 1, Host = 2, All = Certificate | Host }
- Flags for disabling security features, supports a bitwise combination of its member values.
Constructors, destructors, conversion operators
- operator bool() const explicit noexcept
- Whether the object is valid.
Public functions
- auto IsValid() const -> bool noexcept
- Returns
true
if the object is valid. -
void SetHeader(Containers::
StringView name, Containers:: StringView value) - Sets a request header which will be sent to the server by this request.
-
void SetMethod(Containers::
StringView method) - Sets the HTTP request method.
-
void SetData(Containers::
StringView text, Containers:: StringView contentType) - Sets the text to be posted to the server in this request.
-
auto SetData(std::
unique_ptr<Stream> dataStream, Containers:: StringView contentType, std:: int64_t dataSize = -1) -> bool - Sets the binary data to be posted to the server in this request.
- auto GetStorage() const -> Storage
- Returns the destination storage where the response data will be stored.
- void SetStorage(Storage storage)
- Sets the destination storage where the response data will be stored.
- auto GetResponse() const -> WebResponse
- Returns the server response.
-
auto GetBytesSent() const -> std::
int64_t - Returns the number of bytes sent to the server.
-
auto GetBytesExpectedToSend() const -> std::
int64_t - Returns the total number of bytes expected to be sent to the server.
-
auto GetBytesReceived() const -> std::
int64_t - Returns the number of bytes received from the server.
-
auto GetBytesExpectedToReceive() const -> std::
int64_t - Returns the number of bytes expected to be received from the server.
- auto GetNativeHandle() const -> WebRequestHandle noexcept
- Returns the native handle corresponding to this request object.
-
void MakeInsecure(Ignore flags = Ignore::
All) - Makes the connection insecure by disabling security checks.
- auto GetSecurityFlags() const -> Ignore
- Returns security bypass flags.
- void DisablePeerVerify(bool disable = true)
- Disables SSL certificate verification.
- auto IsPeerVerifyDisabled() const -> bool
- Returns
true
if SSL certificate verification is disabled.
Enum documentation
enum class Death:: IO:: WebRequestBase:: State
Request state.
Enumerators | |
---|---|
Idle |
The request has just been created and WebRequestAsync:: |
Unauthorized |
The request is currently unauthorized |
Active |
The request is about to start |
Completed |
The request completed successfully and all data has been received |
Failed |
The request failed |
Cancelled |
The request has been cancelled before completion by calling WebRequestAsync:: |
enum class Death:: IO:: WebRequestBase:: Ignore
Flags for disabling security features, supports a bitwise combination of its member values.
Enumerators | |
---|---|
None |
None |
Certificate |
Disable SSL certificate verification |
Host |
Disable hostname verification |
All |
Disable all security checks for maximum insecurity |