From ab4810b05b0fa5c6d7cd7b8e32afbc39c9ad98cc Mon Sep 17 00:00:00 2001 From: frosty Date: Mon, 30 Mar 2026 04:58:46 +0300 Subject: fix: fixed bug regarding cookies on send_redirect --- src/http.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/http.c b/src/http.c index 3f6294d..faec11a 100644 --- a/src/http.c +++ b/src/http.c @@ -93,14 +93,18 @@ void send_redirect(const char *location) { return; } - char http_response_header[BUFFER_SIZE]; + char http_response_header[BUFFER_SIZE * 2]; + char cookie_headers[BUFFER_SIZE]; + + build_cookie_headers(cookie_headers, sizeof(cookie_headers)); snprintf(http_response_header, sizeof(http_response_header), "HTTP/1.1 302 Found\r\n" - "Location: %s\r\n" - "Connection: close\r\n" - "\r\n", - location); + "Location: %s\r\n" + "%s" + "Connection: close\r\n" + "\r\n", + location, cookie_headers); if (send(current_client_socket, http_response_header, strlen(http_response_header), 0) < 0) { -- cgit v1.2.3