Home | History | Annotate | Download | only in utils

Lines Matching defs:curl

10 #include <curl/curl.h>
37 CURL *curl;
64 if (ctx->curl) {
65 curl_easy_cleanup(ctx->curl);
66 ctx->curl = NULL;
116 static int curl_cb_debug(CURL *curl, curl_infotype info, char *buf, size_t len,
1277 static CURLcode curl_cb_ssl(CURL *curl, void *sslctx, void *parm)
1309 static CURL * setup_curl_post(struct http_ctx *ctx, const char *address,
1314 CURL *curl;
1324 curl = curl_easy_init();
1325 if (curl == NULL)
1328 curl_easy_setopt(curl, CURLOPT_URL, address);
1329 curl_easy_setopt(curl, CURLOPT_POST, 1L);
1331 curl_easy_setopt(curl, CURLOPT_CAINFO, ca_fname);
1332 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
1334 curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, curl_cb_ssl);
1335 curl_easy_setopt(curl, CURLOPT_SSL_CTX_DATA, ctx);
1344 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYSTATUS, 1L);
1348 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
1351 curl_easy_setopt(curl, CURLOPT_SSLCERT, client_cert);
1352 curl_easy_setopt(curl, CURLOPT_SSLKEY, client_key);
1356 curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
1357 curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_cb_debug);
1358 curl_easy_setopt(curl, CURLOPT_DEBUGDATA, ctx);
1359 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_cb_write);
1360 curl_easy_setopt(curl, CURLOPT_WRITEDATA, ctx);
1361 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
1363 curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
1364 curl_easy_setopt(curl, CURLOPT_USERNAME, username);
1365 curl_easy_setopt(curl, CURLOPT_PASSWORD, password);
1368 return curl;
1398 ctx->curl = setup_curl_post(ctx, ctx->svc_address, ca_fname, username,
1400 if (ctx->curl == NULL)
1420 curl_easy_setopt(ctx->curl, CURLOPT_HTTPHEADER, ctx->curl_hdr);
1480 curl_easy_setopt(ctx->curl, CURLOPT_POSTFIELDS, str);
1483 res = curl_easy_perform(ctx->curl);
1495 curl_easy_getinfo(ctx->curl, CURLINFO_RESPONSE_CODE, &http);
1580 CURL *curl;
1587 wpa_printf(MSG_DEBUG, "curl: Download file from %s to %s (ca=%s)",
1589 curl = curl_easy_init();
1590 if (curl == NULL)
1595 curl_easy_cleanup(curl);
1599 curl_easy_setopt(curl, CURLOPT_URL, url);
1601 curl_easy_setopt(curl, CURLOPT_CAINFO, ca_fname);
1602 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
1603 curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
1605 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
1607 curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_cb_debug);
1608 curl_easy_setopt(curl, CURLOPT_DEBUGDATA, ctx);
1609 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
1610 curl_easy_setopt(curl, CURLOPT_WRITEDATA, f);
1611 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
1613 res = curl_easy_perform(curl);
1619 curl_easy_cleanup(curl);
1624 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http);
1625 wpa_printf(MSG_DEBUG, "curl: Server response code %ld", http);
1629 curl_easy_cleanup(curl);
1634 curl_easy_cleanup(curl);
1651 CURL *curl;
1655 wpa_printf(MSG_DEBUG, "curl: HTTP POST to %s", url);
1656 curl = setup_curl_post(ctx, url, ca_fname, username, password,
1658 if (curl == NULL)
1668 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, curl_hdr);
1670 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
1673 res = curl_easy_perform(curl);
1683 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http);
1684 wpa_printf(MSG_DEBUG, "curl: Server response code %ld", http);