Lines Matching refs:ctx
240 struct cw_download_ctx *ctx = writer->ctx; in cw_download_write() local
245 if(!is_connect && !ctx->started_response) { in cw_download_write()
247 ctx->started_response = TRUE; in cw_download_write()
396 writer->ctx = p; in Curl_cwriter_create()
639 struct cr_in_ctx *ctx = reader->ctx; in cr_in_init() local
641 ctx->read_cb = data->state.fread_func; in cr_in_init()
642 ctx->cb_user_data = data->state.in; in cr_in_init()
643 ctx->total_len = -1; in cr_in_init()
644 ctx->read_len = 0; in cr_in_init()
654 struct cr_in_ctx *ctx = reader->ctx; in cr_in_read() local
657 ctx->is_paused = FALSE; in cr_in_read()
660 if(ctx->errored) { in cr_in_read()
663 return ctx->error_result; in cr_in_read()
665 if(ctx->seen_eos) { in cr_in_read()
671 if(ctx->total_len >= 0) { in cr_in_read()
672 curl_off_t remain = ctx->total_len - ctx->read_len; in cr_in_read()
679 if(ctx->read_cb && blen) { in cr_in_read()
681 nread = ctx->read_cb(buf, 1, blen, ctx->cb_user_data); in cr_in_read()
683 ctx->has_used_cb = TRUE; in cr_in_read()
688 if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) { in cr_in_read()
691 ctx->read_len, ctx->total_len); in cr_in_read()
696 ctx->seen_eos = TRUE; in cr_in_read()
703 ctx->errored = TRUE; in cr_in_read()
704 ctx->error_result = CURLE_ABORTED_BY_CALLBACK; in cr_in_read()
717 ctx->is_paused = TRUE; in cr_in_read()
729 ctx->errored = TRUE; in cr_in_read()
730 ctx->error_result = CURLE_READ_ERROR; in cr_in_read()
733 ctx->read_len += nread; in cr_in_read()
734 if(ctx->total_len >= 0) in cr_in_read()
735 ctx->seen_eos = (ctx->read_len >= ctx->total_len); in cr_in_read()
737 *peos = ctx->seen_eos; in cr_in_read()
742 blen, ctx->total_len, ctx->read_len, CURLE_OK, in cr_in_read()
750 struct cr_in_ctx *ctx = reader->ctx; in cr_in_needs_rewind() local
752 return ctx->has_used_cb; in cr_in_needs_rewind()
758 struct cr_in_ctx *ctx = reader->ctx; in cr_in_total_length() local
760 return ctx->total_len; in cr_in_total_length()
767 struct cr_in_ctx *ctx = reader->ctx; in cr_in_resume_from() local
772 if(ctx->read_len) in cr_in_resume_from()
798 actuallyread = ctx->read_cb(scratch, 1, readthisamountnow, in cr_in_resume_from()
799 ctx->cb_user_data); in cr_in_resume_from()
814 if(ctx->total_len > 0) { in cr_in_resume_from()
815 ctx->total_len -= offset; in cr_in_resume_from()
817 if(ctx->total_len <= 0) { in cr_in_resume_from()
829 struct cr_in_ctx *ctx = reader->ctx; in cr_in_rewind() local
832 if(!ctx->has_used_cb) in cr_in_rewind()
883 struct cr_in_ctx *ctx = reader->ctx; in cr_in_unpause() local
885 ctx->is_paused = FALSE; in cr_in_unpause()
892 struct cr_in_ctx *ctx = reader->ctx; in cr_in_is_paused() local
894 return ctx->is_paused; in cr_in_is_paused()
928 reader->ctx = p; in Curl_creader_create()
957 struct cr_lc_ctx *ctx = reader->ctx; in cr_lc_init() local
959 Curl_bufq_init2(&ctx->buf, (16 * 1024), 1, BUFQ_OPT_SOFT_LIMIT); in cr_lc_init()
965 struct cr_lc_ctx *ctx = reader->ctx; in cr_lc_close() local
967 Curl_bufq_free(&ctx->buf); in cr_lc_close()
976 struct cr_lc_ctx *ctx = reader->ctx; in cr_lc_read() local
981 if(ctx->eos) { in cr_lc_read()
987 if(Curl_bufq_is_empty(&ctx->buf)) { in cr_lc_read()
988 if(ctx->read_eos) { in cr_lc_read()
989 ctx->eos = TRUE; in cr_lc_read()
998 ctx->read_eos = eos; in cr_lc_read()
1002 if(ctx->read_eos) in cr_lc_read()
1003 ctx->eos = TRUE; in cr_lc_read()
1005 *peos = ctx->eos; in cr_lc_read()
1013 if((buf[i] != '\n') || ctx->prev_cr) { in cr_lc_read()
1014 ctx->prev_cr = (buf[i] == '\r'); in cr_lc_read()
1017 ctx->prev_cr = FALSE; in cr_lc_read()
1019 result = Curl_bufq_cwrite(&ctx->buf, buf + start, i - start, &n); in cr_lc_read()
1021 result = Curl_bufq_cwrite(&ctx->buf, STRCONST("\r\n"), &n); in cr_lc_read()
1035 result = Curl_bufq_cwrite(&ctx->buf, buf + start, i - start, &n); in cr_lc_read()
1041 DEBUGASSERT(!Curl_bufq_is_empty(&ctx->buf)); in cr_lc_read()
1043 result = Curl_bufq_cread(&ctx->buf, buf, blen, pnread); in cr_lc_read()
1044 if(!result && ctx->read_eos && Curl_bufq_is_empty(&ctx->buf)) { in cr_lc_read()
1046 ctx->eos = TRUE; in cr_lc_read()
1127 struct cr_in_ctx *ctx; in Curl_creader_set_fread() local
1132 ctx = r->ctx; in Curl_creader_set_fread()
1133 ctx->total_len = len; in Curl_creader_set_fread()
1279 struct cr_buf_ctx *ctx = reader->ctx; in cr_buf_read() local
1280 size_t nread = ctx->blen - ctx->index; in cr_buf_read()
1283 if(!nread || !ctx->buf) { in cr_buf_read()
1290 memcpy(buf, ctx->buf + ctx->index, nread); in cr_buf_read()
1292 ctx->index += nread; in cr_buf_read()
1293 *peos = (ctx->index == ctx->blen); in cr_buf_read()
1303 struct cr_buf_ctx *ctx = reader->ctx; in cr_buf_needs_rewind() local
1305 return ctx->index > 0; in cr_buf_needs_rewind()
1311 struct cr_buf_ctx *ctx = reader->ctx; in cr_buf_total_length() local
1313 return (curl_off_t)ctx->blen; in cr_buf_total_length()
1320 struct cr_buf_ctx *ctx = reader->ctx; in cr_buf_resume_from() local
1326 if(ctx->index) in cr_buf_resume_from()
1331 if(boffset > ctx->blen) in cr_buf_resume_from()
1334 ctx->buf += boffset; in cr_buf_resume_from()
1335 ctx->blen -= boffset; in cr_buf_resume_from()
1359 struct cr_buf_ctx *ctx; in Curl_creader_set_buf() local
1364 ctx = r->ctx; in Curl_creader_set_buf()
1365 ctx->buf = buf; in Curl_creader_set_buf()
1366 ctx->blen = blen; in Curl_creader_set_buf()
1367 ctx->index = 0; in Curl_creader_set_buf()