diff options
author | Aki <please@ignore.pl> | 2020-05-08 17:23:07 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2020-05-08 17:24:48 +0200 |
commit | a883cd22cec2d7f9f5318f043bf0062452f7abf4 (patch) | |
tree | e9ed7176d3b7865e495c07bbbba9cc754c990ac7 | |
parent | 5ba3cb56c2832f5885bd05be9ed88a9434451c21 (diff) | |
download | plop-a883cd22cec2d7f9f5318f043bf0062452f7abf4.zip plop-a883cd22cec2d7f9f5318f043bf0062452f7abf4.tar.gz plop-a883cd22cec2d7f9f5318f043bf0062452f7abf4.tar.bz2 |
Added error responses in selected cases
-rw-r--r-- | plop.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; |