2 * Copyright (c) 2018 Virtuozzo International GmbH
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 #include "qemu/osdep.h"
12 int download_url(const char *name
, const char *url
)
16 CURL
*curl
= curl_easy_init();
22 file
= fopen(name
, "wb");
28 curl_easy_setopt(curl
, CURLOPT_URL
, url
);
29 curl_easy_setopt(curl
, CURLOPT_WRITEFUNCTION
, NULL
);
30 curl_easy_setopt(curl
, CURLOPT_WRITEDATA
, file
);
31 curl_easy_setopt(curl
, CURLOPT_FOLLOWLOCATION
, 1);
32 curl_easy_setopt(curl
, CURLOPT_NOPROGRESS
, 0);
34 if (curl_easy_perform(curl
) != CURLE_OK
) {
44 curl_easy_cleanup(curl
);