kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 915b8e1d3cc477aa357c29c95715591c08321a3a
parent f0f1296265c5bb84b259b719d60e2891df6f4aca
Author: Joris Vink <joris@coders.se>
Date:   Mon, 15 Jan 2018 22:31:54 +0100

Use kore_bufs on the stack rather than the pools.

Diffstat:
src/http.c | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/http.c b/src/http.c @@ -1156,7 +1156,7 @@ void http_populate_multipart_form(struct http_request *req) { int h, blen; - struct kore_buf *in, *out; + struct kore_buf in, out; char *type, *val, *args[3]; char boundary[HTTP_BOUNDARY_MAX]; @@ -1181,28 +1181,28 @@ http_populate_multipart_form(struct http_request *req) if (blen == -1 || (size_t)blen >= sizeof(boundary)) return; - in = kore_buf_alloc(128); - out = kore_buf_alloc(128); + kore_buf_init(&in, 128); + kore_buf_init(&out, 128); - if (!multipart_find_data(in, NULL, NULL, req, boundary, blen)) + if (!multipart_find_data(&in, NULL, NULL, req, boundary, blen)) goto cleanup; for (;;) { - if (!multipart_find_data(in, NULL, NULL, req, "\r\n", 2)) + if (!multipart_find_data(&in, NULL, NULL, req, "\r\n", 2)) break; - if (in->offset < 4 && req->http_body_length == 0) + if (in.offset < 4 && req->http_body_length == 0) break; - if (!multipart_find_data(in, out, NULL, req, "\r\n\r\n", 4)) + if (!multipart_find_data(&in, &out, NULL, req, "\r\n\r\n", 4)) break; - if (!multipart_parse_headers(req, in, out, boundary, blen)) + if (!multipart_parse_headers(req, &in, &out, boundary, blen)) break; - kore_buf_reset(out); + kore_buf_reset(&out); } cleanup: - kore_buf_free(in); - kore_buf_free(out); + kore_buf_cleanup(&in); + kore_buf_cleanup(&out); } int