Mercurial > hg > orthanc
diff OrthancFramework/Sources/HttpClient.cpp @ 4297:785a2713323e
abi continued
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 05 Nov 2020 17:20:49 +0100 |
parents | 2d5209153b32 |
children | 3af1d763763a |
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpClient.cpp Thu Nov 05 15:52:28 2020 +0100 +++ b/OrthancFramework/Sources/HttpClient.cpp Thu Nov 05 17:20:49 2020 +0100 @@ -677,6 +677,41 @@ curl_easy_cleanup(pimpl_->curl_); } + void HttpClient::SetUrl(const char *url) + { + url_ = std::string(url); + } + + void HttpClient::SetUrl(const std::string &url) + { + url_ = url; + } + + const std::string &HttpClient::GetUrl() const + { + return url_; + } + + void HttpClient::SetMethod(HttpMethod method) + { + method_ = method; + } + + HttpMethod HttpClient::GetMethod() const + { + return method_; + } + + void HttpClient::SetTimeout(long seconds) + { + timeout_ = seconds; + } + + long HttpClient::GetTimeout() const + { + return timeout_; + } + void HttpClient::SetBody(const std::string& data) { @@ -684,6 +719,16 @@ pimpl_->requestBody_.Clear(); } + std::string &HttpClient::GetBody() + { + return body_; + } + + const std::string &HttpClient::GetBody() const + { + return body_; + } + void HttpClient::SetBody(IRequestBody& body) { @@ -714,6 +759,11 @@ } } + bool HttpClient::IsVerbose() const + { + return isVerbose_; + } + void HttpClient::AddHeader(const std::string& key, const std::string& value) @@ -1033,6 +1083,31 @@ credentials_ = std::string(username) + ":" + std::string(password); } + void HttpClient::SetProxy(const std::string &proxy) + { + proxy_ = proxy; + } + + void HttpClient::SetHttpsVerifyPeers(bool verify) + { + verifyPeers_ = verify; + } + + bool HttpClient::IsHttpsVerifyPeers() const + { + return verifyPeers_; + } + + void HttpClient::SetHttpsCACertificates(const std::string &certificates) + { + caCertificates_ = certificates; + } + + const std::string &HttpClient::GetHttpsCACertificates() const + { + return caCertificates_; + } + void HttpClient::ConfigureSsl(bool httpsVerifyPeers, const std::string& httpsVerifyCertificates) @@ -1104,6 +1179,33 @@ return ApplyInternal(wrapper); } + bool HttpClient::Apply(std::string &answerBody) + { + return ApplyInternal(answerBody, NULL); + } + + bool HttpClient::Apply(Json::Value &answerBody) + { + return ApplyInternal(answerBody, NULL); + } + + bool HttpClient::Apply(std::string &answerBody, + HttpClient::HttpHeaders &answerHeaders) + { + return ApplyInternal(answerBody, &answerHeaders); + } + + bool HttpClient::Apply(Json::Value &answerBody, + HttpClient::HttpHeaders &answerHeaders) + { + return ApplyInternal(answerBody, &answerHeaders); + } + + HttpStatus HttpClient::GetLastStatus() const + { + return lastStatus_; + } + void HttpClient::ApplyAndThrowException(IAnswer& answer) { @@ -1181,6 +1283,51 @@ clientCertificateKeyPassword_ = certificateKeyPassword; } + void HttpClient::SetPkcs11Enabled(bool enabled) + { + pkcs11Enabled_ = enabled; + } + + bool HttpClient::IsPkcs11Enabled() const + { + return pkcs11Enabled_; + } + + const std::string &HttpClient::GetClientCertificateFile() const + { + return clientCertificateFile_; + } + + const std::string &HttpClient::GetClientCertificateKeyFile() const + { + return clientCertificateKeyFile_; + } + + const std::string &HttpClient::GetClientCertificateKeyPassword() const + { + return clientCertificateKeyPassword_; + } + + void HttpClient::SetConvertHeadersToLowerCase(bool lowerCase) + { + headersToLowerCase_ = lowerCase; + } + + bool HttpClient::IsConvertHeadersToLowerCase() const + { + return headersToLowerCase_; + } + + void HttpClient::SetRedirectionFollowed(bool follow) + { + redirectionFollowed_ = follow; + } + + bool HttpClient::IsRedirectionFollowed() const + { + return redirectionFollowed_; + } + void HttpClient::InitializePkcs11(const std::string& module, const std::string& pin,