Lines Matching refs:state

156         CURLState *state = &s->states[i];  in curl_find_buf()  local
157 size_t buf_end = (state->buf_start + state->buf_off); in curl_find_buf()
158 size_t buf_fend = (state->buf_start + state->buf_len); in curl_find_buf()
160 if (!state->orig_buf) in curl_find_buf()
162 if (!state->buf_off) in curl_find_buf()
166 if ((start >= state->buf_start) && in curl_find_buf()
168 (end >= state->buf_start) && in curl_find_buf()
171 char *buf = state->orig_buf + (start - state->buf_start); in curl_find_buf()
180 if ((start >= state->buf_start) && in curl_find_buf()
182 (end >= state->buf_start) && in curl_find_buf()
187 acb->start = start - state->buf_start; in curl_find_buf()
191 if (!state->acb[j]) { in curl_find_buf()
192 state->acb[j] = acb; in curl_find_buf()
230 CURLState *state = NULL; in curl_multi_do() local
231 curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, (char**)&state); in curl_multi_do()
232 curl_clean_state(state); in curl_multi_do()
244 CURLState *state = NULL; in curl_init_state() local
255 state = &s->states[i]; in curl_init_state()
256 state->in_use = 1; in curl_init_state()
259 if (!state) { in curl_init_state()
263 } while(!state); in curl_init_state()
265 if (state->curl) in curl_init_state()
268 state->curl = curl_easy_init(); in curl_init_state()
269 if (!state->curl) in curl_init_state()
271 curl_easy_setopt(state->curl, CURLOPT_URL, s->url); in curl_init_state()
272 curl_easy_setopt(state->curl, CURLOPT_TIMEOUT, 5); in curl_init_state()
273 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); in curl_init_state()
274 curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state); in curl_init_state()
275 curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state); in curl_init_state()
276 curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1); in curl_init_state()
277 curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); in curl_init_state()
278 curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1); in curl_init_state()
279 curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg); in curl_init_state()
282 curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1); in curl_init_state()
287 state->s = s; in curl_init_state()
289 return state; in curl_init_state()
302 CURLState *state = NULL; in curl_open() local
355 state = curl_init_state(s); in curl_open()
356 if (!state) in curl_open()
361 curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); in curl_open()
362 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_size_cb); in curl_open()
363 if (curl_easy_perform(state->curl)) in curl_open()
365 curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d); in curl_open()
366 curl_easy_setopt(state->curl, CURLOPT_WRITEFUNCTION, (void *)curl_read_cb); in curl_open()
367 curl_easy_setopt(state->curl, CURLOPT_NOBODY, 0); in curl_open()
374 curl_clean_state(state); in curl_open()
375 curl_easy_cleanup(state->curl); in curl_open()
376 state->curl = NULL; in curl_open()
389 fprintf(stderr, "CURL: Error opening file: %s\n", state->errmsg); in curl_open()
390 curl_easy_cleanup(state->curl); in curl_open()
391 state->curl = NULL; in curl_open()
415 CURLState *state; in curl_aio_readv() local
438 state = curl_init_state(s); in curl_aio_readv()
439 if (!state) in curl_aio_readv()
445 state->buf_off = 0; in curl_aio_readv()
446 if (state->orig_buf) in curl_aio_readv()
447 qemu_free(state->orig_buf); in curl_aio_readv()
448 state->buf_start = start; in curl_aio_readv()
449 state->buf_len = acb->end + s->readahead_size; in curl_aio_readv()
450 end = MIN(start + state->buf_len, s->len) - 1; in curl_aio_readv()
451 state->orig_buf = qemu_malloc(state->buf_len); in curl_aio_readv()
452 state->acb[0] = acb; in curl_aio_readv()
454 snprintf(state->range, 127, "%zd-%zd", start, end); in curl_aio_readv()
456 (nb_sectors * SECTOR_SIZE), start, state->range); in curl_aio_readv()
457 curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); in curl_aio_readv()
459 curl_multi_add_handle(s->multi, state->curl); in curl_aio_readv()