Lines Matching refs:ctx
44 dechunk_context_t *ctx;
46 ctx = serf_bucket_mem_alloc(allocator, sizeof(*ctx));
47 ctx->stream = stream;
48 ctx->state = STATE_SIZE;
50 serf_linebuf_init(&ctx->linebuf);
52 return serf_bucket_create(&serf_bucket_type_dechunk, allocator, ctx);
57 dechunk_context_t *ctx = bucket->data;
59 serf_bucket_destroy(ctx->stream);
68 dechunk_context_t *ctx = bucket->data;
72 switch (ctx->state) {
76 status = serf_linebuf_fetch(&ctx->linebuf, ctx->stream,
82 if (ctx->linebuf.state == SERF_LINEBUF_READY) {
85 if (ctx->linebuf.used == sizeof(ctx->linebuf.line))
87 ctx->linebuf.line[ctx->linebuf.used] = '\0';
90 ctx->body_left = apr_strtoi64(ctx->linebuf.line, NULL, 16);
95 if (ctx->body_left == 0) {
97 ctx->state = STATE_DONE;
102 ctx->state = STATE_CHUNK;
120 if (requested > ctx->body_left) {
121 requested = ctx->body_left;
125 status = serf_bucket_read(ctx->stream, requested, data, len);
132 ctx->body_left -= *len;
133 if (!ctx->body_left) {
134 ctx->state = STATE_TERM;
135 ctx->body_left = 2; /* CRLF */
139 if (ctx->body_left && APR_STATUS_IS_EOF(status)) {
148 status = serf_bucket_read(ctx->stream, ctx->body_left, data, len);
155 ctx->body_left -= *len;
158 if (ctx->body_left && APR_STATUS_IS_EOF(status))
161 if (!ctx->body_left) {
162 ctx->state = STATE_SIZE;