X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcarddav%2Fcarddav-connect.cpp;h=a2654972f368cfa82763546090a02d2a8cec10d0;hb=274f4cd4b1b656e0ad4119e3969c9ccf59a2f209;hp=0f7ec5c5aeb9a7a071330272a39e7943550f0ab2;hpb=11d1592bfb434c97350ca31bf8f13c85e2249adb;p=xestiaab%2F.git diff --git a/source/carddav/carddav-connect.cpp b/source/carddav/carddav-connect.cpp index 0f7ec5c..a265497 100644 --- a/source/carddav/carddav-connect.cpp +++ b/source/carddav/carddav-connect.cpp @@ -72,22 +72,6 @@ bool CardDAV::Connect(){ // Try SSL first. - - /* - char *ServerAdrSSLChar = new char[(ServerAddressSSL.Length() - 1)]; - //memset(ServerAdrSSLChar, 0, ServerAddressSSL.Length()); - strncpy(ServerAdrSSLChar, (const char*)ServerAddressSSL.mb_str(wxConvUTF8), (ServerAddressSSL.Length() - 1)); - - char *ServerAdrNorChar = new char[(ServerAddressNormal.Length() - 1)]; - //memset(ServerAdrNorChar, 0, ServerAddressSSL.Length()); - strncpy(ServerAdrNorChar, (const char*)ServerAddressNormal.mb_str(wxConvUTF8), (ServerAddressNormal.Length() - 1)); - - char *ServerAuthChar = new char[(ServerAuth.Length() - 1)]; - //memset(ServerAuthChar, 0, ServerAddressSSL.Length()); - strncpy(ServerAuthChar, (const char*)ServerAuth.mb_str(wxConvUTF8), (ServerAuth.Length() - 1)); - - */ - if (ServerSSL){ union { @@ -100,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)); @@ -129,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); @@ -139,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); @@ -147,6 +143,12 @@ bool CardDAV::Connect(){ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0L); } +#if defined(__APPLE__) || defined(__WIN32__) + + SetConnectionObject(conn); + +#endif + conncode = (curl_easy_perform(conn)); ptr.certdata = NULL;