comparison Core/HttpClient.cpp @ 1973:7bd4cb780feb

Option "HttpsVerifyPeers" can be used to connect against self-signed HTTPS certificates
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 11 Apr 2016 15:17:53 +0200
parents b1291df2f780
children 99b249867052
comparison
equal deleted inserted replaced
1972:38fb3f524d81 1973:7bd4cb780feb
219 // Setup HTTPS-related options 219 // Setup HTTPS-related options
220 #if ORTHANC_SSL_ENABLED == 1 220 #if ORTHANC_SSL_ENABLED == 1
221 if (IsHttpsVerifyPeers()) 221 if (IsHttpsVerifyPeers())
222 { 222 {
223 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CAINFO, GetHttpsCACertificates().c_str())); 223 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CAINFO, GetHttpsCACertificates().c_str()));
224 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYHOST, 2)); // libcurl default is strict verifyhost
224 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYPEER, 1)); 225 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYPEER, 1));
225 } 226 }
226 else 227 else
227 { 228 {
229 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYHOST, 0));
228 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYPEER, 0)); 230 CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYPEER, 0));
229 } 231 }
230 #endif 232 #endif
231 233
232 // Reset the parameters from previous calls to Apply() 234 // Reset the parameters from previous calls to Apply()