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 b5e122419b5c443dfb93a94276ea8c510f297a47
parent 4a8d8ab7f85c0c5a695eff69afdde3fbc99c3b8f
Author: Joris Vink <joris@coders.se>
Date:   Tue,  3 Jul 2018 08:25:06 +0200

Let http_populate_post() listen to content-type

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

diff --git a/src/http.c b/src/http.c @@ -1033,12 +1033,17 @@ http_populate_post(struct http_request *req) ssize_t ret; int i, v; struct kore_buf *body; + const char *content; char data[BUFSIZ]; char *args[HTTP_MAX_QUERY_ARGS], *val[3], *string; if (req->method != HTTP_METHOD_POST) return; + if (!http_request_header(req, "content-type", &content) || + strcasecmp(content, "application/x-www-form-urlencoded")) + return; + if (req->http_body != NULL) { body = NULL; req->http_body->offset = req->content_length;