diff options
| author | spl3g <spleefer6@yandex.ru> | 2025-03-16 19:51:19 +0300 |
|---|---|---|
| committer | spl3g <spleefer6@yandex.ru> | 2025-03-16 19:51:19 +0300 |
| commit | 175f1284f8f8d66a23f7aaf0f898e2dfea40c483 (patch) | |
| tree | a537a94f5109fe81e16e2cbdbaaa28e0721b83ca /main.c | |
| parent | 8ceb8fe77cb431dd4d866cbffd935cb2c101074c (diff) | |
Add query processing and parse error handling
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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; } |
