changeset 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 38fb3f524d81
children ea4b8975d064
files Core/HttpClient.cpp NEWS Resources/Configuration.json
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Core/HttpClient.cpp	Mon Apr 11 14:02:18 2016 +0200
+++ b/Core/HttpClient.cpp	Mon Apr 11 15:17:53 2016 +0200
@@ -221,10 +221,12 @@
     if (IsHttpsVerifyPeers())
     {
       CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_CAINFO, GetHttpsCACertificates().c_str()));
+      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYHOST, 2));  // libcurl default is strict verifyhost
       CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYPEER, 1)); 
     }
     else
     {
+      CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYHOST, 0)); 
       CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_SSL_VERIFYPEER, 0)); 
     }
 #endif
--- a/NEWS	Mon Apr 11 14:02:18 2016 +0200
+++ b/NEWS	Mon Apr 11 15:17:53 2016 +0200
@@ -37,6 +37,7 @@
 * Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
 * Upgrade to Boost 1.60.0 for static builds
 * Use of HTTP status 403 Forbidden (instead of 401) if access to a REST resource is disallowed
+* Option "HttpsVerifyPeers" can be used to connect against self-signed HTTPS certificates
 
 
 Version 1.0.0 (2015/12/15)
--- a/Resources/Configuration.json	Mon Apr 11 14:02:18 2016 +0200
+++ b/Resources/Configuration.json	Mon Apr 11 15:17:53 2016 +0200
@@ -177,7 +177,10 @@
   // Set the timeout for HTTP requests issued by Orthanc (in seconds).
   "HttpTimeout" : 10,
 
-  // Enable the verification of the peers during HTTPS requests.
+  // Enable the verification of the peers during HTTPS requests. This
+  // option must be set to "false" if using self-signed certificates.
+  // Pay attention that setting this option to "false" results in
+  // security risks!
   // Reference: http://curl.haxx.se/docs/sslcerts.html
   "HttpsVerifyPeers" : true,