From 65da3f8c4d47ef046f6a24eae15e725738506bce Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Thu, 12 May 2016 22:52:45 +0100 Subject: [PATCH] Win32 Support: Setup initial connection --- source/carddav/carddav-connect.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/carddav/carddav-connect.cpp b/source/carddav/carddav-connect.cpp index 3674e9a..a265497 100644 --- a/source/carddav/carddav-connect.cpp +++ b/source/carddav/carddav-connect.cpp @@ -84,6 +84,15 @@ bool CardDAV::Connect(){ // Setup two initial connections and attempt to get the certificate data. curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8)); + curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_easy_setopt(conn, CURLOPT_TIMEOUT, 60); + curl_easy_setopt(conn, CURLOPT_FAILONERROR, TRUE); + curl_easy_setopt(conn, CURLOPT_USERAGENT, XSDAB_USERAGENT); + curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, WritebackFunc); + curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData); + curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader); + curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(conn, CURLOPT_CERTINFO, 1); conncode = (curl_easy_perform(conn)); @@ -113,6 +122,8 @@ bool CardDAV::Connect(){ } + ServerAddressSSL.append("principals/"); + curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8)); curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY); @@ -123,6 +134,7 @@ bool CardDAV::Connect(){ curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, WritebackFunc); curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData); curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader); + curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, "OPTIONS"); curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(conn, CURLOPT_CERTINFO, 1); @@ -131,7 +143,7 @@ bool CardDAV::Connect(){ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0L); } -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(__WIN32__) SetConnectionObject(conn); -- 2.39.2