15 #include <http_sender.h> 16 #include <client_http.hpp> 19 using HttpClient = SimpleWeb::Client<SimpleWeb::HTTP>;
28 unsigned int connect_timeout = 0,
29 unsigned int request_timeout = 0,
30 unsigned int retry_sleep_Time = 1,
31 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; }
55 std::string getHostPort() {
return m_host_port; };
56 std::string getHTTPResponse() {
return m_HTTPResponse; };
59 void setOCSNamespace (std::string& OCSNamespace) {m_OCSNamespace = OCSNamespace; }
60 void setOCSTenantId (std::string& OCSTenantId) {m_OCSTenantId = OCSTenantId; }
61 void setOCSClientId (std::string& OCSClientId) {m_OCSClientId = OCSClientId; }
62 void setOCSClientSecret (std::string& OCSClientSecret) {m_OCSClientSecret = OCSClientSecret; }
63 void setOCSToken (std::string& OCSToken) {m_OCSToken = OCSToken; }
74 std::string m_host_port;
76 std::string m_HTTPResponse;
77 unsigned int m_retry_sleep_time;
78 unsigned int m_max_retry;
80 std::string m_authMethod;
81 std::string m_authBasicCredentials;
84 std::string m_OCSNamespace;
85 std::string m_OCSTenantId;
86 std::string m_OCSClientId;
87 std::string m_OCSClientSecret;
88 std::string m_OCSToken;
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.
void setProxy(const std::string &proxy)
Set the host and port of the proxy server.
Definition: simple_http.cpp:90
~SimpleHttp()
Destructor.
Definition: simple_http.cpp:98
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_http.cpp:113
Definition: http_sender.h:20
Definition: simple_http.h:21