|
| SimpleHttp (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.
|
|
| ~SimpleHttp () |
| 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) |
|
std::string | getHostPort () |
|
std::string | getHTTPResponse () |
|
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) |
|
| HttpSender () |
| Constructor: More...
|
|
virtual | ~HttpSender () |
| Destructor.
|
|
◆ sendRequest()
int SimpleHttp::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.
- 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 on success or 0 on execptions
Implements HttpSender.
◆ setProxy()
void SimpleHttp::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_http.h
- C/plugins/common/simple_http.cpp