Lines Matching refs:ctx
49 dechunk_context_t *ctx;
51 ctx = serf_bucket_mem_alloc(allocator, sizeof(*ctx));
52 ctx->stream = stream;
53 ctx->state = STATE_SIZE;
55 serf_linebuf_init(&ctx->linebuf);
57 return serf_bucket_create(&serf_bucket_type_dechunk, allocator, ctx);
62 dechunk_context_t *ctx = bucket->data;
64 serf_bucket_destroy(ctx->stream);
73 dechunk_context_t *ctx = bucket->data;
77 switch (ctx->state) {
81 status = serf_linebuf_fetch(&ctx->linebuf, ctx->stream,
87 if (ctx->linebuf.state == SERF_LINEBUF_READY) {
90 if (ctx->linebuf.used == sizeof(ctx->linebuf.line))
92 ctx->linebuf.line[ctx->linebuf.used] = '\0';
95 ctx->body_left = apr_strtoi64(ctx->linebuf.line, NULL, 16);
100 if (ctx->body_left == 0) {
102 ctx->state = STATE_DONE;
107 ctx->state = STATE_CHUNK;
125 if (requested > ctx->body_left) {
126 requested = ctx->body_left;
130 status = serf_bucket_read(ctx->stream, requested, data, len);
137 ctx->body_left -= *len;
138 if (!ctx->body_left) {
139 ctx->state = STATE_TERM;
140 ctx->body_left = 2; /* CRLF */
144 if (ctx->body_left && APR_STATUS_IS_EOF(status)) {
153 status = serf_bucket_read(ctx->stream, ctx->body_left, data, len);
160 ctx->body_left -= *len;
163 if (ctx->body_left && APR_STATUS_IS_EOF(status))
166 if (!ctx->body_left) {
167 ctx->state = STATE_SIZE;