Lines Matching full:curl
2 * QEMU Block driver for CURL images
35 #include <curl/curl.h>
41 /* CURL 7.85.0 switches to a string based API for specifying
96 CURL *curl; member
162 static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, in curl_sock_cb() argument
169 curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&state); in curl_sock_cb()
260 /* curl will error out if we do not return this value */ in curl_read_cb()
349 /* Don't lose the original error message from curl, since in curl_multi_check_completion()
353 error_report("curl: %s", state->errmsg); in curl_multi_check_completion()
355 error_report("curl: further errors suppressed"); in curl_multi_check_completion()
456 if (!state->curl) { in curl_init_state()
457 state->curl = curl_easy_init(); in curl_init_state()
458 if (!state->curl) { in curl_init_state()
461 if (curl_easy_setopt(state->curl, CURLOPT_URL, s->url) || in curl_init_state()
462 curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYPEER, in curl_init_state()
464 curl_easy_setopt(state->curl, CURLOPT_SSL_VERIFYHOST, in curl_init_state()
469 if (curl_easy_setopt(state->curl, CURLOPT_COOKIE, s->cookie)) { in curl_init_state()
473 if (curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, (long)s->timeout) || in curl_init_state()
474 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, in curl_init_state()
476 curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state) || in curl_init_state()
477 curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state) || in curl_init_state()
478 curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || in curl_init_state()
479 curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1) || in curl_init_state()
480 curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1) || in curl_init_state()
481 curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg) || in curl_init_state()
482 curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1)) { in curl_init_state()
486 if (curl_easy_setopt(state->curl, CURLOPT_USERNAME, s->username)) { in curl_init_state()
491 if (curl_easy_setopt(state->curl, CURLOPT_PASSWORD, s->password)) { in curl_init_state()
496 if (curl_easy_setopt(state->curl, in curl_init_state()
502 if (curl_easy_setopt(state->curl, in curl_init_state()
517 if (curl_easy_setopt(state->curl, in curl_init_state()
519 curl_easy_setopt(state->curl, in curl_init_state()
524 if (curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS) || in curl_init_state()
525 curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS)) { in curl_init_state()
531 if (curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1)) { in curl_init_state()
542 curl_easy_cleanup(state->curl); in curl_init_state()
543 state->curl = NULL; in curl_init_state()
556 curl_multi_remove_handle(s->s->multi, s->curl); in curl_clean_state()
580 if (s->states[i].curl) { in curl_detach_aio_context()
581 curl_easy_cleanup(s->states[i].curl); in curl_detach_aio_context()
582 s->states[i].curl = NULL; in curl_detach_aio_context()
614 .name = "curl",
635 .help = "Curl timeout"
681 /* CURL >= 7.55.0 uses curl_off_t for content length instead of a double */ in curl_open()
692 ret = bdrv_apply_auto_read_only(bs, "curl driver does not support writes", in curl_open()
737 "curl driver cannot handle both cookie and cookie secret"); in curl_open()
752 error_setg(errp, "curl block driver requires an 'url' option"); in curl_open()
759 error_setg(errp, "%s curl driver cannot handle the URL '%s' (does not " in curl_open()
801 "curl library initialization failed."); in curl_open()
806 if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1) || in curl_open()
807 curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb) || in curl_open()
808 curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s)) { in curl_open()
810 "curl library initialization failed."); in curl_open()
813 if (curl_easy_perform(state->curl)) in curl_open()
815 /* CURL 7.55.0 deprecates CURLINFO_CONTENT_LENGTH_DOWNLOAD in favour of in curl_open()
819 if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl)) { in curl_open()
823 if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl)) { in curl_open()
827 /* Prior CURL 7.19.4 return value of 0 could mean that the file size is not in curl_open()
828 * know or the size is zero. From 7.19.4 CURL returns -1 if size is not in curl_open()
858 curl_easy_cleanup(state->curl); in curl_open()
859 state->curl = NULL; in curl_open()
867 error_setg(errp, "CURL: Error opening file: %s", state->errmsg); in curl_open()
868 curl_easy_cleanup(state->curl); in curl_open()
869 state->curl = NULL; in curl_open()
936 if (curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range) || in curl_setup_preadv()
937 curl_multi_add_handle(s->multi, state->curl) != CURLM_OK) { in curl_setup_preadv()
945 /* Tell curl it needs to kick things off */ in curl_setup_preadv()