Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <UrlClient.h>
Classes | |
class | cCallbacks |
Callbacks that are used for progress and result reporting. More... | |
Public Types | |
using | cCallbacksPtr = std::shared_ptr< cCallbacks > |
enum | eHTTPStatus { HTTP_STATUS_OK = 200 , HTTP_STATUS_MULTIPLE_CHOICES = 300 , HTTP_STATUS_MOVED_PERMANENTLY = 301 , HTTP_STATUS_FOUND = 302 , HTTP_STATUS_SEE_OTHER = 303 , HTTP_STATUS_TEMPORARY_REDIRECT = 307 } |
Used for HTTP status codes. More... | |
Static Public Member Functions | |
static std::pair< bool, AString > | BlockingGet (const AString &a_URL, AStringMap a_Headers={}, const AString &a_Body={}, const AStringMap &a_Options={}) |
Alias for BlockingRequest("GET", ...) More... | |
static std::pair< bool, AString > | BlockingPost (const AString &a_URL, AStringMap &&a_Headers, const AString &a_Body, const AStringMap &a_Options={}) |
Alias for BlockingRequest("POST", ...) More... | |
static std::pair< bool, AString > | BlockingPut (const AString &a_URL, AStringMap &&a_Headers, const AString &a_Body, const AStringMap &a_Options={}) |
Alias for BlockingRequest("PUT", ...) More... | |
static std::pair< bool, AString > | BlockingRequest (const AString &a_Method, const AString &a_URL, AStringMap &&a_Headers={}, const AString &a_Body={}, const AStringMap &a_Options={}) |
Sends a generic request and block until a response is received or an error occurs. More... | |
static std::pair< bool, AString > | Get (const AString &a_URL, cCallbacksPtr &&a_Callbacks, AStringMap &&a_Headers={}, const AString &a_Body={}, const AStringMap &a_Options={}) |
Alias for Request("GET", ...) More... | |
static std::pair< bool, AString > | Post (const AString &a_URL, cCallbacksPtr &&a_Callbacks, AStringMap &&a_Headers, const AString &a_Body, const AStringMap &a_Options={}) |
Alias for Request("POST", ...) More... | |
static std::pair< bool, AString > | Put (const AString &a_URL, cCallbacksPtr &&a_Callbacks, AStringMap &&a_Headers, const AString &a_Body, const AStringMap &a_Options={}) |
Alias for Request("PUT", ...) More... | |
static std::pair< bool, AString > | Request (const AString &a_Method, const AString &a_URL, cCallbacksPtr &&a_Callbacks, AStringMap &&a_Headers, const AString &a_Body, const AStringMap &a_Options) |
Makes a network request to the specified URL, using the specified method (if applicable). More... | |
Definition at line 34 of file UrlClient.h.
using cUrlClient::cCallbacksPtr = std::shared_ptr<cCallbacks> |
Definition at line 90 of file UrlClient.h.
Used for HTTP status codes.
Enumerator | |
---|---|
HTTP_STATUS_OK | |
HTTP_STATUS_MULTIPLE_CHOICES | |
HTTP_STATUS_MOVED_PERMANENTLY | |
HTTP_STATUS_FOUND | |
HTTP_STATUS_SEE_OTHER | |
HTTP_STATUS_TEMPORARY_REDIRECT |
Definition at line 94 of file UrlClient.h.
|
static |
Alias for BlockingRequest("GET", ...)
Definition at line 779 of file UrlClient.cpp.
|
static |
Alias for BlockingRequest("POST", ...)
Definition at line 793 of file UrlClient.cpp.
|
static |
Alias for BlockingRequest("PUT", ...)
Definition at line 807 of file UrlClient.cpp.
|
static |
Sends a generic request and block until a response is received or an error occurs.
The first returned value specifies whether the response was received successfully. If successful, the second value provides the actual response data.
Definition at line 744 of file UrlClient.cpp.
|
static |
Alias for Request("GET", ...)
Definition at line 693 of file UrlClient.cpp.
|
static |
Alias for Request("POST", ...)
Definition at line 710 of file UrlClient.cpp.
|
static |
Alias for Request("PUT", ...)
Definition at line 727 of file UrlClient.cpp.
|
static |
Makes a network request to the specified URL, using the specified method (if applicable).
The response is reported via the a_ResponseCallback callback, in a single call. The metadata about the response (HTTP headers) are reported via a_InfoCallback before the a_ResponseCallback call. If there is an asynchronous error, it is reported in via the a_ErrorCallback. If there is an immediate error (misformatted URL etc.), the function returns false and an error message. a_Headers contains additional headers to use for the request. a_Body specifies optional body to include with the request, if applicable. a_Options contains various options for the request that govern the request behavior, but aren't sent to the server, such as the proxy server, whether to follow redirects, and client certificate for TLS.
Definition at line 675 of file UrlClient.cpp.