curl.c (c76f4952bbf47116255bc00780ceae3bc8a657c0) | curl.c (df3cee1a3a2bfd5747acbf7a056cf89bba8df825) |
---|---|
1/* 2 * QEMU Block driver for CURL images 3 * 4 * Copyright (c) 2009 Alexander Graf <agraf@suse.de> 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 255 unchanged lines hidden (view full) --- 264 if (state->curl) 265 goto has_curl; 266 267 state->curl = curl_easy_init(); 268 if (!state->curl) 269 return NULL; 270 curl_easy_setopt(state->curl, CURLOPT_URL, s->url); 271 curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, 5); | 1/* 2 * QEMU Block driver for CURL images 3 * 4 * Copyright (c) 2009 Alexander Graf <agraf@suse.de> 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 255 unchanged lines hidden (view full) --- 264 if (state->curl) 265 goto has_curl; 266 267 state->curl = curl_easy_init(); 268 if (!state->curl) 269 return NULL; 270 curl_easy_setopt(state->curl, CURLOPT_URL, s->url); 271 curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, 5); |
272 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, curl_read_cb); | 272 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); |
273 curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state); 274 curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state); 275 curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1); 276 curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); 277 curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1); 278 curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg); 279 280#ifdef DEBUG_VERBOSE --- 72 unchanged lines hidden (view full) --- 353 s->url = file; 354 state = curl_init_state(s); 355 if (!state) 356 goto out_noclean; 357 358 // Get file size 359 360 curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); | 273 curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state); 274 curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state); 275 curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1); 276 curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); 277 curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1); 278 curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg); 279 280#ifdef DEBUG_VERBOSE --- 72 unchanged lines hidden (view full) --- 353 s->url = file; 354 state = curl_init_state(s); 355 if (!state) 356 goto out_noclean; 357 358 // Get file size 359 360 curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); |
361 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, curl_size_cb); | 361 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_size_cb); |
362 if (curl_easy_perform(state->curl)) 363 goto out; 364 curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d); | 362 if (curl_easy_perform(state->curl)) 363 goto out; 364 curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d); |
365 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, curl_read_cb); | 365 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); |
366 curl_easy_setopt(state->curl, CURLOPT_NOBODY, 0); 367 if (d) 368 s->len = (size_t)d; 369 else if(!s->len) 370 goto out; 371 dprintf("CURL: Size = %lld\n", (long long)s->len); 372 373 curl_clean_state(state); --- 189 unchanged lines hidden --- | 366 curl_easy_setopt(state->curl, CURLOPT_NOBODY, 0); 367 if (d) 368 s->len = (size_t)d; 369 else if(!s->len) 370 goto out; 371 dprintf("CURL: Size = %lld\n", (long long)s->len); 372 373 curl_clean_state(state); --- 189 unchanged lines hidden --- |