+
+void CalDAV::SetupDefaultParametersNonSSL(bool doAuthentication){
+
+ std::string serverAddress = "";
+
+ string serverAddressURL = "http://" + connectionData.hostname + ":" + to_string(connectionData.port) + "/";
+ string usernamePassword = connectionData.username + ":" + connectionData.password;
+
+ curl_easy_setopt(connectionHandle, CURLOPT_URL, serverAddressURL.c_str());
+ curl_easy_setopt(connectionHandle, CURLOPT_NOPROGRESS, 1L);
+ curl_easy_setopt(connectionHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST|CURLAUTH_BASIC);
+ curl_easy_setopt(connectionHandle, CURLOPT_TIMEOUT, 60);
+ curl_easy_setopt(connectionHandle, CURLOPT_FAILONERROR, true);
+ curl_easy_setopt(connectionHandle, CURLOPT_USERAGENT, XSDCAL_USERAGENT);
+ curl_easy_setopt(connectionHandle, CURLOPT_NOSIGNAL, 1L);
+ curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "GET");
+ curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, nullptr);
+ curl_easy_setopt(connectionHandle, CURLOPT_POSTFIELDS, nullptr);
+ curl_easy_setopt(connectionHandle, CURLOPT_POSTFIELDSIZE, 0L);
+
+ if (doAuthentication == true){
+ curl_easy_setopt(connectionHandle, CURLOPT_USERPWD, usernamePassword.c_str());
+ } else {
+ curl_easy_setopt(connectionHandle, CURLOPT_USERPWD, NULL);
+ }
+
+}
+
+void CalDAV::SetupDefaultParametersSSL(bool doAuthentication){
+
+ // Setup the default parameters.
+
+ string ServerAddressURL = "https://" + connectionData.hostname + ":" + to_string(connectionData.port) + "/";
+ string UsernamePassword = connectionData.username + ":" + connectionData.password;
+
+ curl_easy_setopt(connectionHandle, CURLOPT_URL, ServerAddressURL.c_str());
+ curl_easy_setopt(connectionHandle, CURLOPT_NOPROGRESS, 1L);
+ curl_easy_setopt(connectionHandle, CURLOPT_CERTINFO, 1L);
+ curl_easy_setopt(connectionHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST|CURLAUTH_BASIC);
+ curl_easy_setopt(connectionHandle, CURLOPT_TIMEOUT, 60);
+ curl_easy_setopt(connectionHandle, CURLOPT_FAILONERROR, 0L);
+ curl_easy_setopt(connectionHandle, CURLOPT_USERAGENT, XSDCAL_USERAGENT);
+ curl_easy_setopt(connectionHandle, CURLOPT_ERRORBUFFER, sessionErrorBuffer);
+ curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "GET");
+ curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, nullptr);
+ curl_easy_setopt(connectionHandle, CURLOPT_POSTFIELDS, nullptr);
+ curl_easy_setopt(connectionHandle, CURLOPT_POSTFIELDSIZE, 0L);
+
+ if (doAuthentication == true){
+ curl_easy_setopt(connectionHandle, CURLOPT_USERPWD, UsernamePassword.c_str());
+ } else {
+ curl_easy_setopt(connectionHandle, CURLOPT_USERPWD, NULL);
+ }
+
+ if (enableSSLBypass == true){
+ curl_easy_setopt(connectionHandle, CURLOPT_SSL_VERIFYHOST, 0L);
+ curl_easy_setopt(connectionHandle, CURLOPT_SSL_VERIFYPEER, 0L);
+ curl_easy_setopt(connectionHandle, CURLOPT_SSL_VERIFYSTATUS, 0L);
+ } else {
+ curl_easy_setopt(connectionHandle, CURLOPT_SSL_VERIFYHOST, 2L);
+ curl_easy_setopt(connectionHandle, CURLOPT_SSL_VERIFYPEER, 1L);
+ curl_easy_setopt(connectionHandle, CURLOPT_SSL_VERIFYSTATUS, 1L);
+ }
+
+#if !defined(__APPLE__) || defined(__WIN32__)
+
+ if (connectionData.account.size() > 0){
+
+ // Check if the server certificate file exists.
+
+ string certificateFilename = GetAccountDir(connectionData.account, true);
+
+ if (wxFile::Exists(certificateFilename)){
+
+ curl_easy_setopt(connectionHandle, CURLOPT_CAINFO, certificateFilename.c_str());
+
+ }
+
+ }
+
+#endif
+
+}
+
+void CalDAV::ResetResults(){
+
+ sslStatus = false;
+ COSSLVerified SSLVerified = COSSL_NORESULT;
+ validResponse = false;
+ authPassed = false;
+ sslSelfSigned = false;
+ //taskCompleted = false;
+ errorMessage = "";
+ sessionErrorBuffer[0] = '\0';
+ //sessionResult = CURLE_OK;
+ serverData = "";
+ serverHeader = "";
+ /*if (headerList != nullptr){
+ curl_slist_free_all(headerList);
+ headerList = nullptr;
+ }*/
+
+}
\ No newline at end of file