|
| SimpleHttps (const std::string &host_port, unsigned int connect_timeout=0, unsigned int request_timeout=0, unsigned int retry_sleep_Time=1, unsigned int max_retry=4) |
| Constructor: pass host:port, connect & request timeouts.
|
|
| ~SimpleHttps () |
| Destructor.
|
|
void | setProxy (const std::string &proxy) |
| Set the host and port of the proxy server. More...
|
|
int | sendRequest (const std::string &method=std::string(HTTP_SENDER_DEFAULT_METHOD), const std::string &path=std::string(HTTP_SENDER_DEFAULT_PATH), const std::vector< std::pair< std::string, std::string >> &headers={}, const std::string &payload=std::string()) |
| HTTP(S) request: pass method and path, HTTP headers and POST/PUT payload. More...
|
|
void | setAuthMethod (std::string &authMethod) |
|
void | setAuthBasicCredentials (std::string &authBasicCredentials) |
|
void | setOCSNamespace (std::string &OCSNamespace) |
|
void | setOCSTenantId (std::string &OCSTenantId) |
|
void | setOCSClientId (std::string &OCSClientId) |
|
void | setOCSClientSecret (std::string &OCSClientSecret) |
|
void | setOCSToken (std::string &OCSToken) |
|
std::string | getHTTPResponse () |
|
std::string | getHostPort () |
|
| HttpSender () |
| Constructor: More...
|
|
virtual | ~HttpSender () |
| Destructor.
|
|
◆ sendRequest()
int SimpleHttps::sendRequest |
( |
const std::string & |
method = std::string(HTTP_SENDER_DEFAULT_METHOD) , |
|
|
const std::string & |
path = std::string(HTTP_SENDER_DEFAULT_PATH) , |
|
|
const std::vector< std::pair< std::string, std::string >> & |
headers = {} , |
|
|
const std::string & |
payload = std::string() |
|
) |
| |
|
virtual |
HTTP(S) request: pass method and path, HTTP headers and POST/PUT payload.
Send data, it retries the operation m_max_retry times waiting m_retry_sleep_time*2 at each attempt.
- Parameters
-
method | The HTTP method (GET, POST, ...) |
path | The URL path |
headers | The optional headers to send |
payload | The optional data payload (for POST, PUT) |
- Returns
- The HTTP code for the cases : 1xx Informational / 2xx Success / 3xx Redirection
- Exceptions
-
BadRequest | for HTTP 400 error std::exception as generic exception for all the cases >= 401 Client errors / 5xx Server errors |
Implements HttpSender.
◆ setProxy()
void SimpleHttps::setProxy |
( |
const std::string & |
proxy | ) |
|
|
virtual |
Set the host and port of the proxy server.
Set a proxy server.
- Parameters
-
proxy | The name and port of the proxy server |
Implements HttpSender.
The documentation for this class was generated from the following files:
- C/plugins/common/include/simple_https.h
- C/plugins/common/simple_https.cpp