diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-08-13 01:23:48 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-08-13 01:23:48 +0200 |
| commit | f6562ddab30feb4bb63d9cda9801dbf607c33d07 (patch) | |
| tree | d37b89e44ad92fd6fcb94387b982d4b3cfc46f71 | |
| parent | 4ee88984fcca86c5b0c9c4bbb7e9148c7d2fe9db (diff) | |
http.c: Merge payload_{get,post} into process_payload
Both functions were in fact identical, so there was no reason to keep
two definitions rather than one.
| -rw-r--r-- | http.c | 20 |
1 files changed, 3 insertions, 17 deletions
@@ -905,7 +905,7 @@ static struct http_payload ctx_to_payload(const struct ctx *const c) }; } -static int payload_get(struct http_ctx *const h, const char *const line) +static int process_payload(struct http_ctx *const h, const char *const line) { struct ctx *const c = &h->ctx; const struct http_payload p = ctx_to_payload(c); @@ -919,20 +919,6 @@ static int payload_get(struct http_ctx *const h, const char *const line) return start_response(h); } -static int payload_post(struct http_ctx *const h, const char *const line) -{ - struct ctx *const c = &h->ctx; - const struct http_payload pl = ctx_to_payload(c); - const int ret = h->cfg.payload(&pl, &h->wctx.r, h->cfg.user); - - ctx_free(c); - - if (ret) - return ret; - - return start_response(h); -} - static int get_field_value(const char *const line, size_t *const n, const char **const value) { @@ -1052,12 +1038,12 @@ static int header_cr_line(struct http_ctx *const h) switch (c->op) { case HTTP_OP_GET: - return payload_get(h, line); + return process_payload(h, line); case HTTP_OP_POST: { if (!c->post.len) - return payload_post(h, line); + return process_payload(h, line); else if (c->boundary) { const int res = check_length(h); |
