+
+ /* Setup HTTP request */
+ if (!(cal->curl = curl_easy_init()))
+ error("Curl easy init failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_URL, cal->location))
+ error("Curl easy setopt failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_WRITEFUNCTION, on_write))
+ error("Curl easy set write function failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_WRITEDATA, cal))
+ error("Curl easy set write data failed");
+
+ /* Skip SSL checks */
+ if (curl_easy_setopt(cal->curl, CURLOPT_SSL_VERIFYPEER, 0L))
+ error("Curl easy set no verify peer failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_SSL_VERIFYHOST, 0L))
+ error("Curl easy set no verify hosts failed");
+
+ /* Set login info */
+ if (curl_easy_setopt(cal->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY))
+ error("Curl easy set http auth failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_USERNAME, cal->username))
+ error("Curl easy set username failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_PASSWORD, cal->password))
+ error("Curl easy set password failed");
+
+ /* Setup SOAP request */
+ hdr = curl_slist_append(hdr, "Accept: text/xml");
+ hdr = curl_slist_append(hdr, "Content-Type: text/xml");
+ if (curl_easy_setopt(cal->curl, CURLOPT_HTTPHEADER, hdr))
+ error("Curl easy set http header failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_POST, 1L))
+ error("Curl easy set post failed");
+ if (curl_easy_setopt(cal->curl, CURLOPT_POSTFIELDS, req_calendar))
+ error("Curl easy set post failed");
+
+ /* Curl Easy */
+ if ((err = curl_easy_perform(cal->curl)))
+ error("Curl easy perform failed: %s", curl_easy_strerror(err));
+ if ((err = curl_easy_getinfo(cal->curl, CURLINFO_RESPONSE_CODE, &status)))
+ error("Curl easy get info failed: %s", curl_easy_strerror(err));
+
+ /* Output response */
+ if (cal->debug)
+ printf("EWS -- HTTP Status %ld\n", status);
+ if (cal->debug && !cal->buf.data)
+ printf("EWS -- No Response Data\n");
+ if (cal->debug)
+ dump_xml(cal->buf.data, cal->buf.len);
+
+ /* Cleanup */
+ curl_easy_cleanup(cal->curl);
+ release(&cal->buf);