aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.c b/main.c
index 7cea88f..42cfd21 100644
--- a/main.c
+++ b/main.c
@@ -6,6 +6,11 @@ void success(struct request req, struct response *resp) {
cs_print("Path: %s\n", req.path);
cs_print("Body: %s\n", req.body);
+ for (size_t i = 0; i < req.query.len; i++) {
+ cs_print("%s: ", req.query.data[i].key);
+ cs_print("%s\n", req.query.data[i].val);
+ };
+
resp->code = OK;
resp->body = CS("Hello world!\n");
}
@@ -20,9 +25,5 @@ int main() {
handle_path(&serv, CS("GET"), CS("/"), success);
listen_and_serve(&serv);
- // closing and freeing
- printf("closing sockets");
- close(serv.sockfd);
-
return 0;
}