diff options
Diffstat (limited to 'plop.c')
-rw-r--r-- | plop.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -2,6 +2,7 @@ #include <fcntl.h> #include <netdb.h> #include <poll.h> +#include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> @@ -85,13 +86,16 @@ int handle_client(struct pollfd * pfd, const int shift_by) return -1; // TODO: Handle errors properly } - static const char * body = "plop!"; + struct request request = {0}; + parse_request(pfd->fd, &request); - if (-1 == respond_with_body(pfd->fd, STATUS_OK, body)) + if (-1 == respond_with_body(pfd->fd, STATUS_OK, request.body)) { // TODO: Handle errors properly } + free(request.body); + close(pfd->fd); (pfd - shift_by)->fd = -1; (pfd - shift_by)->events = pfd->events; |