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 f2c87fd130671e7533682f3b1b4866a1df7c94ee
parent d876e41ebbd33af5ce4c08f7ea2378c6f97fc3ba
Author: Joris Vink <joris@coders.se>
Date:   Thu, 28 Jun 2018 14:24:02 +0200

limit filemaps to HEAD/GET requests.

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

diff --git a/src/filemap.c b/src/filemap.c @@ -89,6 +89,13 @@ filemap_resolve(struct http_request *req) size_t best_len; struct filemap_entry *entry, *best; + if (req->method != HTTP_METHOD_GET && + req->method != HTTP_METHOD_HEAD) { + http_response_header(req, "allow", "get, head"); + http_response(req, HTTP_STATUS_BAD_REQUEST, NULL, 0); + return (KORE_RESULT_OK); + } + best = NULL; best_len = 0;