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 480e589dd5f36243dd06fbcf0e2852682bd21802
parent 6b2609c2b861b9e0a99390dd8acc4dca1dc515f1
Author: Joris Vink <joris@coders.se>
Date:   Mon,  6 Dec 2021 14:43:52 +0100

The DELETE method may have a request body.

Diffstat:
src/http.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/http.c b/src/http.c @@ -925,6 +925,11 @@ http_header_recv(struct netbuf *nb) if (!http_request_header_uint64(req, "content-length", &req->content_length)) { + if (req->method == HTTP_METHOD_DELETE) { + req->flags |= HTTP_REQUEST_COMPLETE; + return (KORE_RESULT_OK); + } + req->flags |= HTTP_REQUEST_DELETE; http_error_response(req->owner, HTTP_STATUS_LENGTH_REQUIRED); @@ -1992,7 +1997,7 @@ http_request_new(struct connection *c, const char *host, flags |= HTTP_REQUEST_COMPLETE; } else if (!strcasecmp(method, "delete")) { m = HTTP_METHOD_DELETE; - flags |= HTTP_REQUEST_COMPLETE; + flags |= HTTP_REQUEST_EXPECT_BODY; } else if (!strcasecmp(method, "post")) { m = HTTP_METHOD_POST; flags |= HTTP_REQUEST_EXPECT_BODY;