diff options
Diffstat (limited to 'plop.c')
-rw-r--r-- | plop.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -89,20 +89,21 @@ int handle_client(struct pollfd * pfd, const int shift_by) return -1; // TODO: Handle errors properly } - struct request request = {METHOD_INVALID, NULL}; - parse_request(pfd->fd, &request); + char * request = NULL; - if (-1 == respond_with_body(pfd->fd, STATUS_OK, method_str[request.method])) + if (-1 == collect_request(pfd->fd, &request)) { - // TODO: Handle errors properly + return -1; // TODO: Handle errors properly } - free(request.body); + respond_with_body(pfd->fd, STATUS_OK, request); close(pfd->fd); (pfd - shift_by)->fd = -1; (pfd - shift_by)->events = pfd->events; + free(request); + return shift_by + 1; } |