summaryrefslogtreecommitdiffhomepage
path: root/plop.c
diff options
context:
space:
mode:
Diffstat (limited to 'plop.c')
-rw-r--r--plop.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/plop.c b/plop.c
index 41449ab..601e172 100644
--- a/plop.c
+++ b/plop.c
@@ -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;
}