diff Core/HttpClient.cpp @ 2020:a0bd8cd55da7

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 15 Jun 2016 17:19:10 +0200
parents 9c9332e486ca
children fefbe71c2272
line wrap: on
line diff
--- a/Core/HttpClient.cpp	Tue Jun 14 17:53:23 2016 +0200
+++ b/Core/HttpClient.cpp	Wed Jun 15 17:19:10 2016 +0200
@@ -240,9 +240,36 @@
   }
 
 
-  HttpClient::HttpClient() : pimpl_(new PImpl), verifyPeers_(true)
+  HttpClient::HttpClient() : 
+    pimpl_(new PImpl), 
+    verifyPeers_(true)
+  {
+    Setup();
+  }
+
+
+  HttpClient::HttpClient(const WebServiceParameters& service,
+                         const std::string& uri) : 
+    pimpl_(new PImpl), 
+    verifyPeers_(true)
   {
     Setup();
+
+    if (service.GetUsername().size() != 0 && 
+        service.GetPassword().size() != 0)
+    {
+      SetCredentials(service.GetUsername().c_str(), 
+                     service.GetPassword().c_str());
+    }
+
+    if (!service.GetCertificateFile().empty())
+    {
+      SetClientCertificate(service.GetCertificateFile(),
+                           service.GetCertificateKeyFile(),
+                           service.GetCertificateKeyPassword());
+    }
+
+    SetUrl(service.GetUrl() + uri);
   }