diff options
Diffstat (limited to 'http.c')
| -rw-r--r-- | http.c | 56 |
1 files changed, 10 insertions, 46 deletions
@@ -1595,24 +1595,14 @@ static int end_boundary(struct http_ctx *const h) /* Found end boundary. */ struct ctx *const c = &h->ctx; struct multiform *const m = &c->u.mf; + struct http_payload p = ctx_to_payload(c); - const struct http_payload p = + p.u.post = (const struct http_post) { - .cookie = - { - .field = c->field, - .value = c->value - }, - - .op = c->op, - .resource = c->resource, - .u.post = - { - .files = m->files, - .pairs = m->pairs, - .nfiles = m->nfiles, - .npairs = m->npairs - } + .files = m->files, + .pairs = m->pairs, + .nfiles = m->nfiles, + .npairs = m->npairs }; return send_payload(h, &p); @@ -2079,23 +2069,10 @@ static int read_body_to_mem(struct http_ctx *const h, const char *const buf, if (p->read >= p->len) { - const struct http_payload pl = - { - .cookie = - { - .field = c->field, - .value = c->value - }, - - .op = c->op, - .resource = c->resource, - .u.post = - { - .data = h->line - } - }; + struct http_payload pl = ctx_to_payload(c); h->line[p->len] = '\0'; + pl.u.post.data = h->line; return send_payload(h, &pl); } @@ -2196,22 +2173,9 @@ static int read_to_file(struct http_ctx *const h, const char *const buf, return -1; else if (p->read >= p->len) { - const struct http_payload pl = - { - .cookie = - { - .field = c->field, - .value = c->value - }, - - .op = c->op, - .resource = c->resource, - .u.put = - { - .tmpname = c->u.put.tmpname - } - }; + struct http_payload pl = ctx_to_payload(c); + pl.u.put.tmpname = c->u.put.tmpname; return send_payload(h, &pl); } |
