1 #ifndef _SIMPLE_HTTPS_H 2 #define _SIMPLE_HTTPS_H 15 #include <http_sender.h> 16 #include <client_https.hpp> 19 using HttpsClient = SimpleWeb::Client<SimpleWeb::HTTPS>;
29 unsigned int connect_timeout = 0,
30 unsigned int request_timeout = 0,
31 unsigned int retry_sleep_Time = 1,
32 unsigned int max_retry = 4);
40 void setProxy(
const std::string& proxy);
46 const std::string& method = std::string(HTTP_SENDER_DEFAULT_METHOD),
47 const std::string& path = std::string(HTTP_SENDER_DEFAULT_PATH),
48 const std::vector<std::pair<std::string, std::string>>& headers = {},
49 const std::string& payload = std::string()
52 void setAuthMethod (std::string& authMethod) {m_authMethod = authMethod; }
53 void setAuthBasicCredentials(std::string& authBasicCredentials) {m_authBasicCredentials = authBasicCredentials; }
56 void setOCSNamespace (std::string& OCSNamespace) {m_OCSNamespace = OCSNamespace; }
57 void setOCSTenantId (std::string& OCSTenantId) {m_OCSTenantId = OCSTenantId; }
58 void setOCSClientId (std::string& OCSClientId) {m_OCSClientId = OCSClientId; }
59 void setOCSClientSecret (std::string& OCSClientSecret) {m_OCSClientSecret = OCSClientSecret; }
60 void setOCSToken (std::string& OCSToken) {m_OCSToken = OCSToken; }
62 std::string getHTTPResponse() {
return m_HTTPResponse; };
63 std::string getHostPort() {
return m_host_port; };
72 std::string m_host_port;
73 HttpsClient *m_sender;
74 std::string m_HTTPResponse;
75 unsigned int m_retry_sleep_time;
76 unsigned int m_max_retry;
78 std::string m_authMethod;
79 std::string m_authBasicCredentials;
82 std::string m_OCSNamespace;
83 std::string m_OCSTenantId;
84 std::string m_OCSClientId;
85 std::string m_OCSClientSecret;
86 std::string m_OCSToken;
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.
void setProxy(const std::string &proxy)
Set the host and port of the proxy server.
Definition: simple_https.cpp:101
~SimpleHttps()
Destructor.
Definition: simple_https.cpp:61
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.
Definition: simple_https.cpp:118
Definition: http_sender.h:20
Definition: simple_https.h:21