kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit f80a9cbc6c87f3a7e238715a616b8b815210d115
parent 604fae3a0195d60b60a8acf4a8de8667759df8c3
Author: Joris Vink <joris@coders.se>
Date:   Mon,  6 Feb 2017 22:47:32 +0100

actually urldecode parameter names.

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

diff --git a/src/http.c b/src/http.c @@ -40,11 +40,11 @@ static int http_body_recv(struct netbuf *); static int http_body_rewind(struct http_request *); static void http_error_response(struct connection *, int); -static void http_argument_add(struct http_request *, const char *, char *); +static void http_argument_add(struct http_request *, char *, char *); static void http_response_normal(struct http_request *, struct connection *, int, const void *, size_t); static void multipart_add_field(struct http_request *, struct kore_buf *, - const char *, const char *, const int); + char *, const char *, const int); static void multipart_file_add(struct http_request *, struct kore_buf *, const char *, const char *, const char *, const int); static int multipart_find_data(struct kore_buf *, struct kore_buf *, @@ -1299,7 +1299,7 @@ multipart_parse_headers(struct http_request *req, struct kore_buf *in, static void multipart_add_field(struct http_request *req, struct kore_buf *in, - const char *name, const char *boundary, const int blen) + char *name, const char *boundary, const int blen) { struct kore_buf *data; char *string; @@ -1349,14 +1349,17 @@ multipart_file_add(struct http_request *req, struct kore_buf *in, } static void -http_argument_add(struct http_request *req, const char *name, char *value) +http_argument_add(struct http_request *req, char *name, char *value) { struct http_arg *q; struct kore_handler_params *p; + http_argument_urldecode(name); + TAILQ_FOREACH(p, &(req->hdlr->params), list) { if (p->method != req->method) continue; + if (strcmp(p->name, name)) continue;