Lines Matching refs:ctx

31     if (ctx->status == PREFIX##_ERROR)             \
33 else if (ctx->status == PREFIX##_COMPLETE) \
223 struct mfd_ctx *ctx = apr_palloc(pool, sizeof *ctx);
232 (const char **)&ctx->bdry, &blen);
237 ctx->bdry[blen] = 0;
239 *--ctx->bdry = '-';
240 *--ctx->bdry = '-';
241 *--ctx->bdry = '\n';
242 *--ctx->bdry = '\r';
244 ctx->status = MFD_INIT;
245 ctx->pattern = apr_strmatch_precompile(pool, ctx->bdry, 1);
246 ctx->hdr_parser = apreq_parser_make(pool, ba, "",
250 ctx->info = NULL;
251 ctx->bb = apr_brigade_create(pool, ba);
252 ctx->in = apr_brigade_create(pool, ba);
253 ctx->eos = apr_bucket_eos_create(ba);
254 ctx->next_parser = NULL;
255 ctx->param_name = NULL;
256 ctx->upload = NULL;
257 ctx->level = level;
259 return ctx;
266 struct mfd_ctx *ctx = parser->ctx;
269 if (ctx == NULL) {
270 ctx = create_multipart_context(parser->content_type,
274 if (ctx == NULL)
278 parser->ctx = ctx;
282 APR_BRIGADE_CONCAT(ctx->in, bb);
286 switch (ctx->status) {
290 s = split_on_bdry(ctx->bb, ctx->in, NULL, ctx->bdry + 2);
292 apreq_brigade_setaside(ctx->in, pool);
293 apreq_brigade_setaside(ctx->bb, pool);
296 ctx->status = MFD_NEXTLINE;
298 APR_BRIGADE_CONCAT(bb, ctx->bb);
305 s = split_on_bdry(ctx->bb, ctx->in, NULL, CRLF);
307 ctx->status = MFD_COMPLETE;
311 apreq_brigade_setaside(ctx->in, pool);
312 apreq_brigade_setaside(ctx->bb, pool);
315 if (!APR_BRIGADE_EMPTY(ctx->bb)) {
318 apr_brigade_pflatten(ctx->bb, &line, &len, pool);
321 APR_BRIGADE_CONCAT(bb, ctx->in);
322 ctx->status = MFD_COMPLETE;
325 apr_brigade_cleanup(ctx->bb);
328 ctx->status = MFD_HEADER;
329 ctx->info = NULL;
335 if (ctx->info == NULL) {
336 ctx->info = apr_table_make(pool, APREQ_DEFAULT_NELTS);
338 ctx->hdr_parser->ctx = NULL;
340 s = apreq_parser_run(ctx->hdr_parser, ctx->info, ctx->in);
343 ctx->status = MFD_POST_HEADER;
346 apreq_brigade_setaside(ctx->in, pool);
349 ctx->status = MFD_ERROR;
375 switch (brigade_start_string(ctx->in, ctx->bdry + 2)) {
378 apreq_brigade_setaside(ctx->in, pool);
384 ctx->bb->bucket_alloc);
385 APR_BRIGADE_INSERT_HEAD(ctx->in, e);
392 cd = apr_table_get(ctx->info, "Content-Disposition");
399 ct = apr_table_get(ctx->info, "Content-Type");
404 if (ctx->level >= MAX_LEVEL) {
405 ctx->status = MFD_ERROR;
412 ctx->level + 1);
424 const char *cid = apr_table_get(ctx->info,
432 ctx->next_parser = apreq_parser_make(pool, ba, ct,
438 ctx->status = MFD_MIXED;
448 ctx->status = MFD_ERROR;
460 param->info = ctx->info;
462 = apr_brigade_create(pool, ctx->bb->bucket_alloc);
463 ctx->upload = param;
464 ctx->status = MFD_UPLOAD;
468 ctx->param_name = apr_pstrmemdup(pool, name, nlen);
469 ctx->status = MFD_PARAM;
480 if (s != APR_SUCCESS || ctx->param_name == NULL) {
481 ctx->status = MFD_ERROR;
484 name = ctx->param_name;
489 param->info = ctx->info;
491 ctx->bb->bucket_alloc);
492 ctx->upload = param;
493 ctx->status = MFD_UPLOAD;
499 const char *cid = apr_table_get(ctx->info, "Content-ID");
516 param->info = ctx->info;
518 ctx->bb->bucket_alloc);
519 ctx->upload = param;
520 ctx->status = MFD_UPLOAD;
533 s = split_on_bdry(ctx->bb, ctx->in, ctx->pattern, ctx->bdry);
538 apreq_brigade_setaside(ctx->in, pool);
539 apreq_brigade_setaside(ctx->bb, pool);
543 s = apr_brigade_length(ctx->bb, 1, &off);
545 ctx->status = MFD_ERROR;
549 param = apreq_param_make(pool, ctx->param_name,
550 strlen(ctx->param_name),
553 param->info = ctx->info;
556 apr_brigade_flatten(ctx->bb, v->data, &len);
562 ctx->status = MFD_ERROR;
570 ctx->status = MFD_NEXTLINE;
571 ctx->param_name = NULL;
572 apr_brigade_cleanup(ctx->bb);
576 ctx->status = MFD_ERROR;
586 apreq_param_t *param = ctx->upload;
588 s = split_on_bdry(ctx->bb, ctx->in, ctx->pattern, ctx->bdry);
593 s = apreq_hook_run(parser->hook, param, ctx->bb);
595 ctx->status = MFD_ERROR;
599 apreq_brigade_setaside(ctx->bb, pool);
600 apreq_brigade_setaside(ctx->in, pool);
603 param->upload, ctx->bb);
608 APR_BRIGADE_INSERT_TAIL(ctx->bb, ctx->eos);
609 s = apreq_hook_run(parser->hook, param, ctx->bb);
610 APR_BUCKET_REMOVE(ctx->eos);
612 ctx->status = MFD_ERROR;
617 apreq_brigade_setaside(ctx->bb, pool);
620 param->upload, ctx->bb);
625 ctx->status = MFD_NEXTLINE;
629 ctx->status = MFD_ERROR;
639 s = apreq_parser_run(ctx->next_parser, t, ctx->in);
642 ctx->status = MFD_INIT;
643 ctx->param_name = NULL;
646 APR_BRIGADE_CONCAT(bb, ctx->in);
649 ctx->status = MFD_ERROR;