CURLcode CardDAV::claconncode;\r
int CardDAV::HTTPErrorCode;\r
wxString CardDAV::ErrorMessage;\r
+SSLCertCollection CardDAV::VerifyCertCollection;\r
+bool CardDAV::AllowSelfSign;\r
\r
CardDAV::CardDAV(){\r
ServerPort = 8080;\r
ValidResponse = FALSE;\r
HasCalDAVSupport = FALSE;\r
SSLCertCol.SuccessCode = 0;\r
+ AllowSelfSign = FALSE;\r
\r
AbortConnection = FALSE;\r
UploadMode = FALSE;\r
\r
}\r
\r
+bool CardDAV::IsSelfSigned(){\r
+\r
+ return AllowSelfSign;\r
+\r
+}\r
+\r
/*\r
\r
size_t CardDAV::WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *stream){\r
\r
}\r
\r
+CURLcode CardDAV::SSLVerifyTest(){\r
+\r
+ PageData.Clear();\r
+ PageHeader.Clear();\r
+\r
+ SSLStatus = TRUE;\r
+ AuthPassed = TRUE;\r
+ AbortConnection = FALSE;\r
+\r
+ CURL *conn;\r
+ CURL *connssldata;\r
+ CURLcode conncode;\r
+ wxString ServerAddressURL;\r
+ wxString ServerAuth;\r
+ wxString ServerAddressSSL;\r
+ wxString ServerAddressNormal;\r
+\r
+ conn = curl_easy_init();\r
+\r
+ /*struct CardDAVCURLPasser {\r
+\r
+ CardDAV *Data;\r
+ bool HeaderMode = TRUE;\r
+\r
+ } CardDAVHeader, CardDAVFooter;\r
+\r
+ CardDAVHeader.Data = this;\r
+ CardDAVHeader.HeaderMode = TRUE;\r
+\r
+ CardDAVFooter.Data = this;\r
+ CardDAVFooter.HeaderMode = FALSE;*/\r
+\r
+ wxString Data1;\r
+ wxString Data2;\r
+\r
+ ServerAddressURL = ServerAddress + wxT(":") + wxString::Format(wxT("%i"), ServerPort) + wxT("/");\r
+ ServerAddressSSL = wxT("https://") + ServerAddressURL;\r
+\r
+ if (ServerSSL){\r
+\r
+ union {\r
+ struct curl_slist *certdata;\r
+ struct curl_certinfo *certinfo;\r
+ } ptr;\r
+\r
+ ptr.certdata = NULL;\r
+\r
+ // Setup two initial connections and attempt to get the certificate data.\r
+\r
+ curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8));\r
+ curl_easy_setopt(conn, CURLOPT_CERTINFO, 1);\r
+ curl_easy_setopt(conn, CURLOPT_VERBOSE, 1L);\r
+ //curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, FALSE);\r
+ //curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, FALSE);\r
+ curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, curlerrbuffer);\r
+ curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, WritebackFunc);\r
+ curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData);\r
+ curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader);\r
+\r
+ conncode = (curl_easy_perform(conn));\r
+\r
+ // Check if the SSL certificate is valid or self-signed or some other\r
+ // error occured.\r
+\r
+ if (conncode == CURLE_OK){\r
+\r
+ // Connection is OK. Do nothing.\r
+\r
+ *ServerResult = TRUE;\r
+\r
+ } else if (conncode == CURLE_SSL_CACERT || conncode == CURLE_SSL_CONNECT_ERROR){\r
+\r
+ connssldata = curl_easy_init();\r
+\r
+ // Retry but get the certificates without peer/host verification.\r
+\r
+ curl_easy_setopt(connssldata, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8));\r
+ curl_easy_setopt(connssldata, CURLOPT_CERTINFO, 1);\r
+ curl_easy_setopt(connssldata, CURLOPT_VERBOSE, 1L);\r
+ curl_easy_setopt(connssldata, CURLOPT_ERRORBUFFER, curlerrbuffer);\r
+ curl_easy_setopt(connssldata, CURLOPT_WRITEFUNCTION, WritebackFunc);\r
+ curl_easy_setopt(connssldata, CURLOPT_WRITEDATA, &PageData);\r
+ curl_easy_setopt(connssldata, CURLOPT_WRITEHEADER, &PageHeader);\r
+ curl_easy_setopt(connssldata, CURLOPT_SSL_VERIFYPEER, 0L);\r
+ curl_easy_setopt(connssldata, CURLOPT_SSL_VERIFYHOST, 0L);\r
+\r
+ CURLcode certfetchcode;\r
+\r
+ certfetchcode = (curl_easy_perform(connssldata));\r
+\r
+ VerifyCertCollection = BuildSSLCollection(connssldata);\r
+\r
+ if (certfetchcode == CURLE_OK){\r
+ \r
+ curl_easy_getinfo(connssldata, CURLINFO_CERTINFO, &ptr.certdata);\r
+\r
+ VerifyCertCollection = BuildSSLCollection(connssldata);\r
+\r
+ } else {\r
+\r
+ conncode = certfetchcode;\r
+\r
+ }\r
+\r
+ *ServerResult = FALSE;\r
+\r
+ } else {\r
+\r
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",\r
+ curl_easy_strerror(conncode));\r
+\r
+ ErrorMessage = wxString::Format(wxT("%s"), curl_easy_strerror(conncode));\r
+\r
+ *ServerResult = FALSE;\r
+\r
+ }\r
+\r
+ }\r
+\r
+ curl_easy_cleanup(conn);\r
+\r
+ return conncode;\r
+\r
+}\r
+\r
+SSLCertCollection CardDAV::GetSSLVerifyResults(){\r
+ return VerifyCertCollection;\r
+}\r
+\r
+void CardDAV::AllowSelfSignTest(bool AllowSelfSignIn){\r
+ AllowSelfSign = AllowSelfSignIn;\r
+}\r
+\r
bool CardDAV::Connect(){\r
\r
PageData.Clear();\r
AuthPassed = TRUE;\r
AbortConnection = FALSE;\r
\r
- CURL *conn;\r
- CURLcode conncode;\r
+ CURL *conn;\r
+ CURLcode conncode;\r
wxString ServerAddressURL;\r
wxString ServerAuth;\r
wxString ServerAddressSSL;\r
wxString ServerAddressNormal; \r
\r
conn = curl_easy_init();\r
- \r
+\r
struct CardDAVCURLPasser {\r
\r
CardDAV *Data;\r
\r
if (ServerSSL){\r
\r
+ union {\r
+ struct curl_slist *certdata;\r
+ struct curl_certinfo *certinfo;\r
+ } ptr;\r
+\r
+ ptr.certdata = NULL;\r
+\r
+ // Setup two initial connections and attempt to get the certificate data.\r
+\r
+ curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8));\r
+ curl_easy_setopt(conn, CURLOPT_CERTINFO, 1);\r
+\r
+ conncode = (curl_easy_perform(conn));\r
+\r
+ // Check if the SSL certificate is valid or self-signed or some other\r
+ // error occured.\r
+\r
+ if (conncode == CURLE_OK){\r
+\r
+ // Connection is OK. Do nothing.\r
+\r
+ } else if (conncode == CURLE_SSL_CACERT){\r
+\r
+ // Post message saying SSL certificate is invalid. \r
+\r
+ curl_easy_getinfo(conn, CURLINFO_CERTINFO, &ptr.certdata);\r
+\r
+ } else {\r
+\r
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",\r
+ curl_easy_strerror(conncode));\r
+\r
+ ErrorMessage = wxString::Format(wxT("%s"), curl_easy_strerror(conncode));\r
+\r
+ *ServerResult = FALSE;\r
+ return FALSE;\r
+\r
+ }\r
+\r
curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8));\r
curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 1L);\r
curl_easy_setopt(conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY);\r
curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader);\r
curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1);\r
curl_easy_setopt(conn, CURLOPT_CERTINFO, 1);\r
+ \r
+ if (AllowSelfSign == TRUE){\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, 0L);\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0L);\r
+ }\r
\r
conncode = (curl_easy_perform(conn));\r
-\r
- union {\r
- struct curl_slist *certdata;\r
- struct curl_certinfo *certinfo;\r
- } ptr;\r
\r
ptr.certdata = NULL;\r
\r
\r
if (conncode == CURLE_OK){\r
\r
+ // Process the server header response and look for\r
+ // 'addressbook' within the DAV header.\r
+\r
+ wxStringTokenizer wxSHeaderLines(PageHeader, wxT("\r\n"));\r
+ wxString wxSHeaderLine;\r
+ std::map<int, wxString> DAVHeaderLines;\r
+\r
+ while (wxSHeaderLines.HasMoreTokens()){\r
+\r
+ wxSHeaderLine = wxSHeaderLines.GetNextToken();\r
+\r
+ if (wxSHeaderLine.Mid(0, 4) == wxT("DAV:")){\r
+\r
+ // Look for address book in the line.\r
+\r
+ if (wxSHeaderLine.Find(wxT("addressbook")) != wxNOT_FOUND){\r
+\r
+ HasCalDAVSupport = TRUE;\r
+\r
+ }\r
+\r
+ }\r
+\r
+ }\r
+\r
*ServerResult = TRUE;\r
+ ValidResponse = TRUE;\r
AuthPassed = TRUE;\r
SSLStatus = TRUE;\r
return TRUE;\r
SSLCertCol = BuildSSLCollection(sslerrconn);\r
SSLCertCol.SuccessCode = 1;\r
\r
- return;\r
+ return;\r
\r
} else if (claconncode == CURLE_HTTP_RETURNED_ERROR){\r
\r
\r
// Catch all.\r
\r
- ActIter->second = 1;\r
+ //ActIter->second = 1;\r
*ServerResult = TRUE;\r
return;\r
\r
\r
wxString ServerAddressOnly = wxT("https://") + ServerAddress + wxT(":") + wxString::Format(wxT("%i"), ServerPort) + wxT("/");\r
\r
- curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8));\r
- curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 1L);\r
- curl_easy_setopt(conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY);\r
- curl_easy_setopt(conn, CURLOPT_TIMEOUT, 60);\r
- curl_easy_setopt(conn, CURLOPT_FAILONERROR, TRUE);\r
- curl_easy_setopt(conn, CURLOPT_USERAGENT, XSDAB_USERAGENT); \r
- curl_easy_setopt(conn, CURLOPT_USERPWD, (const char*)ServerAuth.mb_str(wxConvUTF8));\r
- curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, WritebackFunc);\r
- curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData);\r
- curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader);\r
- curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_URL, (const char*)ServerAddressOnly.mb_str(wxConvUTF8));\r
+ curl_easy_setopt(sslerrconn, CURLOPT_NOPROGRESS, 1L);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_HTTPAUTH, CURLAUTH_ANY);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_TIMEOUT, 60);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_FAILONERROR, TRUE);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_USERAGENT, XSDAB_USERAGENT); \r
+ curl_easy_setopt(sslerrconn, CURLOPT_USERPWD, (const char*)ServerAuth.mb_str(wxConvUTF8));\r
+ curl_easy_setopt(sslerrconn, CURLOPT_WRITEFUNCTION, WritebackFunc);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_WRITEDATA, &PageData);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_WRITEHEADER, &PageHeader);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_NOSIGNAL, 1);\r
\r
//UploadData.readptr = &CardDAVDataQuery;\r
//UploadData.sizeleft = CardDAVDataQuery.Len();\r
curl_easy_setopt(sslerrconn, CURLOPT_SSL_VERIFYPEER, 0);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_SSL_VERIFYHOST, 0);\r
curl_easy_setopt(sslerrconn, CURLOPT_CERTINFO, 1);\r
\r
wxString SSLLocalData;\r
// Load the recovery database for tasks not done.\r
\r
if (SSLLocalFile.IsOpened() == TRUE){\r
-\r
- // Check if we are using wxWidgets version 2.8 or less and\r
- // execute the required command accordingly.\r
\r
SSLLocalFile.ReadAll(&SSLLocalData, wxConvAuto());\r
\r
SSLStatus = TRUE;\r
AuthPassed = TRUE;\r
AbortConnection = FALSE;\r
-\r
+ \r
+ bool FilenameIsDirectory = FALSE;\r
CURL *conn;\r
CURLcode conncode;\r
wxString ServerAddressURL;\r
\r
ServerAuth = ServerUser + wxT(":") + ServerPass;\r
\r
+ // Workout if path is directory or filename.\r
+ \r
+ /*if (ServerAddress){\r
+ FilenameIsDirectory = TRUE;\r
+ } else {\r
+ FilenameIsDirectory = FALSE;\r
+ }*/\r
+ \r
// Try SSL first.\r
\r
\r
curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, "REPORT");\r
curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1);\r
curl_easy_setopt(conn, CURLOPT_POSTFIELDS, query);\r
- curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query)); \r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query));\r
\r
claconncode = (curl_easy_perform(conn));\r
\r
\r
wxString ServerAddressOnly = wxT("https://") + ServerAddress + wxT(":") + wxString::Format(wxT("%i"), ServerPort) + wxT("/");\r
\r
+ PageData.clear();\r
+ PageHeader.clear();\r
+\r
curl_easy_setopt(sslerrconn, CURLOPT_URL, (const char*)ServerAddressOnly.mb_str(wxConvUTF8));\r
curl_easy_setopt(sslerrconn, CURLOPT_NOPROGRESS, 0);\r
curl_easy_setopt(sslerrconn, CURLOPT_HTTPAUTH, CURLAUTH_ANY);\r
curl_easy_setopt(sslerrconn, CURLOPT_NOSIGNAL, 1);\r
curl_easy_setopt(sslerrconn, CURLOPT_SSL_VERIFYPEER, 0);\r
curl_easy_setopt(sslerrconn, CURLOPT_CERTINFO, 1);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_SSL_VERIFYPEER, 1);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_SSL_VERIFYHOST, 2);\r
+ curl_easy_setopt(sslerrconn, CURLOPT_CAINFO, (const char*)ServerCertFilename.mb_str(wxConvUTF8));\r
\r
wxString SSLLocalData;\r
wxString SSLServerData;\r
#else\r
SSLLocalFile.Open(ServerCertFilename, wxT("r"));\r
#endif \r
- \r
+\r
// Load the recovery database for tasks not done.\r
\r
if (SSLLocalFile.IsOpened() == TRUE){\r
curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, "REPORT");\r
curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1);\r
curl_easy_setopt(conn, CURLOPT_POSTFIELDS, query);\r
- curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query)); \r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query));\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, 0);\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0); \r
\r
claconncode = (curl_easy_perform(conn));\r
\r
\r
}\r
\r
-\r
-\r
// Sort out SSL error.\r
\r
// When SSL cert error occurs, connect again and fetch certificates.\r
SSLCertCol = BuildSSLCollection(sslerrconn);\r
SSLCertCol.SuccessCode = 1;\r
\r
+ curl_easy_cleanup(conn);\r
+ curl_easy_cleanup(sslerrconn);\r
+\r
return;\r
\r
} else if (claconncode == CURLE_HTTP_RETURNED_ERROR){\r
int http_code = 0;\r
curl_easy_getinfo(conn, CURLINFO_RESPONSE_CODE, &http_code);\r
fprintf(stderr, "Error code was: %d\n", http_code);\r
+\r
+ curl_easy_cleanup(conn);\r
\r
return;\r
\r
curl_easy_getinfo(conn, CURLINFO_RESPONSE_CODE, &http_code);\r
fprintf(stderr, "Error code was: %d\n", http_code);\r
\r
+ curl_easy_cleanup(conn);\r
+\r
return;\r
\r
}\r
\r
fprintf(stderr, "curl_easy_perform() failed: %s\n",\r
curl_easy_strerror(conncode));\r
- \r
+ \r
return;\r
\r
} else {\r
nodeLevel1 = nodeLevel1->next)\r
{\r
\r
+ bool HREFFound = FALSE;\r
+ bool ETagFound = FALSE;\r
+\r
for (nodeLevel2 = nodeLevel1->children;\r
nodeLevel2 != NULL;\r
nodeLevel2 = nodeLevel2->next)\r
nodeLevel3 = nodeLevel3->next)\r
{\r
\r
- bool HREFFound = FALSE;\r
- bool ETagFound = FALSE;\r
-\r
if (!xmlStrcmp(nodeLevel3->name, (const xmlChar *)"href") ||\r
!xmlStrcmp(nodeLevel3->name, (const xmlChar *)"d:href") ||\r
!xmlStrcmp(nodeLevel3->name, (const xmlChar *)"D:href")\r
\r
}\r
\r
- if (HREFFound == TRUE && ETagFound == TRUE){\r
+ }\r
+\r
+ }\r
+ \r
+ if (HREFFound == TRUE && ETagFound == TRUE){\r
\r
- // Add to the map data.\r
+ // Add to the map data.\r
\r
- xmlDataMap.insert(std::make_pair(DataFilename, ETagData));\r
- \r
- }\r
+ xmlDataMap.insert(std::make_pair(DataFilename, ETagData));\r
\r
- // Reset the values.\r
+ HREFFound = FALSE;\r
+ ETagFound = FALSE;\r
\r
- HREFFound = FALSE;\r
- ETagFound = FALSE;\r
-\r
- }\r
-\r
}\r
\r
\r
AuthPassed = TRUE;\r
AbortConnection = FALSE;\r
\r
- CURL *conn;\r
- CURLcode conncode;\r
+ CURL *conn;\r
+ CURLcode conncode;\r
wxString ServerAddressURL;\r
wxString ServerAuth;\r
wxString ServerAddressSSL;\r
\r
ServerAuth = ServerUser + wxT(":") + ServerPass;\r
\r
- wxString SAURLPrincipals = ServerAddressURL + wxT("principals/");\r
- wxString SAURLPrincipalURL = ServerAddress + wxT(":") + wxString::Format(wxT("%i"), ServerPort);\r
- wxString SAURLAddressURL = ServerAddress + wxT(":") + wxString::Format(wxT("%i"), ServerPort);\r
+ wxString SAURLPrincipals;\r
+ wxString SAURLPrincipalURL;\r
+ wxString SAURLAddressURL;\r
+ \r
+ if (ServerSSL){\r
+ \r
+ SAURLPrincipals = ServerAddressSSL + wxT("principals/");\r
+ SAURLPrincipalURL = ServerAddressSSL;\r
+ SAURLAddressURL = ServerAddressSSL;\r
+ \r
+ } else {\r
+ \r
+ SAURLPrincipals = ServerAddressNormal + wxT("principals/");\r
+ SAURLPrincipalURL = ServerAddressNormal;\r
+ SAURLAddressURL = ServerAddressNormal;\r
+ \r
+ }\r
+ \r
wxString FinalPrefix;\r
\r
struct UploadDataStruc UploadData;\r
curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData);\r
curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader);\r
curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1);\r
-\r
- if (UploadMode == TRUE){\r
-\r
- UploadData.readptr = &ServerUploadData;\r
- UploadData.sizeleft = ServerUploadData.Len();\r
- curl_easy_setopt(conn, CURLOPT_UPLOAD, 1);\r
- curl_easy_setopt(conn, CURLOPT_READDATA, &UploadData);\r
- curl_easy_setopt(conn, CURLOPT_READFUNCTION, UploadReadFunc);\r
+ curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, "PROPFIND");\r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDS, query);\r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query));\r
+ curl_easy_setopt(conn, CURLOPT_HTTPHEADER, connhd);\r
\r
+ if (AllowSelfSign == TRUE){\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, 0L);\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0L);\r
}\r
\r
conncode = (curl_easy_perform(conn));\r
\r
*ServerResult = TRUE;\r
AuthPassed = TRUE;\r
+ ValidResponse = TRUE;\r
SSLStatus = TRUE;\r
- return wxT("");\r
\r
} else {\r
\r
\r
if (ServerSSL){\r
\r
- curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8));\r
+ curl_easy_setopt(conn, CURLOPT_URL, (const char*)SAURLPrincipalURL.mb_str(wxConvUTF8));\r
curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 1L);\r
curl_easy_setopt(conn, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);\r
curl_easy_setopt(conn, CURLOPT_TIMEOUT, 60);\r
curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData);\r
curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader);\r
curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1);\r
+ curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, "PROPFIND");\r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDS, query2);\r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query2));\r
+ curl_easy_setopt(conn, CURLOPT_HTTPHEADER, connhd2);\r
\r
- if (UploadMode == TRUE){\r
-\r
- UploadData.readptr = &ServerUploadData;\r
- UploadData.sizeleft = ServerUploadData.Len();\r
- curl_easy_setopt(conn, CURLOPT_UPLOAD, 1);\r
- curl_easy_setopt(conn, CURLOPT_READDATA, &UploadData);\r
- curl_easy_setopt(conn, CURLOPT_READFUNCTION, UploadReadFunc);\r
- \r
+ if (AllowSelfSign == TRUE){\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, 0L);\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0L);\r
}\r
\r
conncode = (curl_easy_perform(conn));\r
*ServerResult = TRUE;\r
AuthPassed = TRUE;\r
SSLStatus = TRUE;\r
- return wxT("");\r
\r
} else {\r
\r
curl_easy_strerror(conncode)); \r
\r
*ServerResult = FALSE;\r
+ ValidResponse = FALSE;\r
\r
curl_easy_getinfo(conn, CURLINFO_RESPONSE_CODE, &HTTPErrorCode);\r
\r
\r
fprintf(stderr, "curl_easy_perform() HTTP code was: %i\n",\r
GetHTTPCode());\r
+ \r
+ ValidResponse = FALSE;\r
+ \r
return wxT("");\r
\r
} else {\r
\r
fprintf(stderr, "curl_easy_perform() failed: %s\n",\r
curl_easy_strerror(conncode));\r
+ \r
+ ValidResponse = FALSE;\r
+ \r
return wxT("");\r
\r
}\r
\r
if (ServerSSL){\r
\r
- curl_easy_setopt(conn, CURLOPT_URL, (const char*)ServerAddressSSL.mb_str(wxConvUTF8));\r
+ curl_easy_setopt(conn, CURLOPT_URL, (const char*)SAURLAddressURL.mb_str(wxConvUTF8));\r
curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 1L);\r
curl_easy_setopt(conn, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);\r
curl_easy_setopt(conn, CURLOPT_TIMEOUT, 60);\r
curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData);\r
curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader);\r
curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1);\r
+ curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, "PROPFIND");\r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDS, query3);\r
+ curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query3));\r
+ curl_easy_setopt(conn, CURLOPT_HTTPHEADER, connhd3);\r
\r
- if (UploadMode == TRUE){\r
-\r
- UploadData.readptr = &ServerUploadData;\r
- UploadData.sizeleft = ServerUploadData.Len();\r
- curl_easy_setopt(conn, CURLOPT_UPLOAD, 1);\r
- curl_easy_setopt(conn, CURLOPT_READDATA, &UploadData);\r
- curl_easy_setopt(conn, CURLOPT_READFUNCTION, UploadReadFunc);\r
- \r
+ if (AllowSelfSign == TRUE){\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, 0L);\r
+ curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0L);\r
}\r
\r
conncode = (curl_easy_perform(conn));\r
*ServerResult = TRUE;\r
AuthPassed = TRUE;\r
SSLStatus = TRUE;\r
- return wxT("");\r
\r
} else {\r
\r
curl_easy_strerror(conncode)); \r
\r
*ServerResult = FALSE;\r
+ ValidResponse = FALSE;\r
\r
curl_easy_getinfo(conn, CURLINFO_RESPONSE_CODE, &HTTPErrorCode);\r
\r
\r
fprintf(stderr, "curl_easy_perform() HTTP code was: %i\n",\r
GetHTTPCode());\r
+ \r
+ ValidResponse = FALSE;\r
+ \r
return wxT("");\r
\r
} else {\r
\r
fprintf(stderr, "curl_easy_perform() failed: %s\n",\r
curl_easy_strerror(conncode));\r
+ \r
+ ValidResponse = FALSE;\r
+ \r
return wxT("");\r
\r
}\r