From a883cd22cec2d7f9f5318f043bf0062452f7abf4 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 8 May 2020 17:23:07 +0200 Subject: Added error responses in selected cases --- plop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plop.c b/plop.c index e90c3b0..1485aa7 100644 --- a/plop.c +++ b/plop.c @@ -100,6 +100,7 @@ int handle_client(lua_State * L, struct pollfd * pfd, char ** data, const int sh if (-1 == collect_request(pfd->fd, data)) { + respond_only_status(pfd->fd, STATUS_BAD_REQUEST); return -1; // TODO: Handle errors properly } @@ -114,6 +115,10 @@ int handle_client(lua_State * L, struct pollfd * pfd, char ** data, const int sh { respond_with_body(pfd->fd, STATUS_OK, body, (int) length); } + else + { + respond_only_status(pfd->fd, STATUS_INTERNAL_SERVER_ERROR); + } close(pfd->fd); (pfd - shift_by)->fd = -1; -- cgit v1.1