summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2020-05-08 17:23:07 +0200
committerAki <please@ignore.pl>2020-05-08 17:24:48 +0200
commita883cd22cec2d7f9f5318f043bf0062452f7abf4 (patch)
treee9ed7176d3b7865e495c07bbbba9cc754c990ac7
parent5ba3cb56c2832f5885bd05be9ed88a9434451c21 (diff)
downloadplop-a883cd22cec2d7f9f5318f043bf0062452f7abf4.zip
plop-a883cd22cec2d7f9f5318f043bf0062452f7abf4.tar.gz
plop-a883cd22cec2d7f9f5318f043bf0062452f7abf4.tar.bz2
Added error responses in selected cases
-rw-r--r--plop.c5
1 files changed, 5 insertions, 0 deletions
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;