From 2f6a862006475b64a7cf3fcef57cf4b55f0df391 Mon Sep 17 00:00:00 2001
From: Steve Brokenshire <sbrokenshire@xestia.co.uk>
Date: Mon, 16 Jan 2017 21:54:06 +0000
Subject: [PATCH] CardDAV2: Fixed bug where non-SSL connections were made as
 SSL ones.

---
 source/carddav2/carddav2.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/source/carddav2/carddav2.cpp b/source/carddav2/carddav2.cpp
index d7c7707..97b22f9 100644
--- a/source/carddav2/carddav2.cpp
+++ b/source/carddav2/carddav2.cpp
@@ -241,7 +241,7 @@ COConnectResult CardDAV2::Connect(bool DoAuthentication){
 	} else {
 		SessionResult = curl_easy_perform(ConnectionSession);		
 	}
-
+	
 	switch(SessionResult){
 		case CURLE_OK:
 		case CURLE_HTTP_RETURNED_ERROR:
@@ -1414,7 +1414,7 @@ void CardDAV2::SetupDefaultParametersNonSSL(bool DoAuthentication){
 	PageHeaderObject.ServerUsingSSL = false;
 	
 	curl_easy_setopt(ConnectionSession, CURLOPT_URL, ServerAddress.c_str());
-	curl_easy_setopt(ConnectionSession, CURLOPT_NOPROGRESS, 0L);
+	curl_easy_setopt(ConnectionSession, CURLOPT_NOPROGRESS, 1L);
 	curl_easy_setopt(ConnectionSession, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST|CURLAUTH_BASIC);
 	curl_easy_setopt(ConnectionSession, CURLOPT_TIMEOUT, 60);
 	curl_easy_setopt(ConnectionSession, CURLOPT_FAILONERROR, true);
@@ -1463,9 +1463,9 @@ void CardDAV2::SetupDefaultParametersSSL(bool DoAuthentication){
 	curl_easy_setopt(ConnectionSession, CURLOPT_WRITEDATA, &PageDataObject);
 	curl_easy_setopt(ConnectionSession, CURLOPT_WRITEHEADER, &PageHeaderObject);
 	curl_easy_setopt(ConnectionSession, CURLOPT_ERRORBUFFER, SessionErrorBuffer);
-	curl_easy_setopt(ConnectionSession, CURLOPT_NOSIGNAL, 1L);
+	//curl_easy_setopt(ConnectionSession, CURLOPT_NOSIGNAL, 1L);
 	curl_easy_setopt(ConnectionSession, CURLOPT_CERTINFO, 1L);
-	curl_easy_setopt(ConnectionSession, CURLOPT_VERBOSE, 2L);
+	//curl_easy_setopt(ConnectionSession, CURLOPT_VERBOSE, 2L);
 	curl_easy_setopt(ConnectionSession, CURLOPT_CUSTOMREQUEST, "GET");
 	curl_easy_setopt(ConnectionSession, CURLOPT_HTTPHEADER, nullptr);
 	curl_easy_setopt(ConnectionSession, CURLOPT_POSTFIELDS, nullptr);
@@ -1514,7 +1514,7 @@ string CardDAV2::BuildURL(string URI){
 	if (SSLStatus == true){
 		ServerAddressURL = "https://" + ServerAddress + ":" + to_string(ServerPort) + URI;	
 	} else {
-		ServerAddressURL = "https://" + ServerAddress + ":" + to_string(ServerPort) + URI;
+		ServerAddressURL = "http://" + ServerAddress + ":" + to_string(ServerPort) + URI;
 	}
 	
 	return ServerAddressURL;
-- 
2.39.5