add null check http_parse

This commit is contained in:
2025-01-28 01:01:20 +01:00
parent 3da61ef47c
commit aebecfb4c2
3 changed files with 24 additions and 8 deletions

View File

@@ -125,6 +125,13 @@ void handle_clients(int sockfd) {
/* Parse HTTP request */
http_t *request = http_parse(data, client_fd);
if (request == NULL) {
close_client(epfd, client_fd, clients);
http_free(request);
continue;
}
http_send_response(request);
fprintf(stdout, BLUE "[server] Client (%s) disconnected\n" RESET, ip);
close_client(epfd, client_fd, clients);