From 1b2a52d214d92f543c9e0651f56c3292b23655a5 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 12 Feb 2026 15:55:13 +0100 Subject: Add optional expiration date to http_cookie_create So far, libweb had been arbitrarily appending a 1-year expiration date to all HTTP cookies. While good enough for some contexts, libweb should allow users to set up their own, if any, so this arbitary decision has been eventually removed. --- include/libweb/http.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libweb/http.h b/include/libweb/http.h index dab19df..bd7769e 100644 --- a/include/libweb/http.h +++ b/include/libweb/http.h @@ -4,6 +4,7 @@ #include #include #include +#include struct http_header { @@ -144,7 +145,8 @@ void http_free(struct http_ctx *h); int http_update(struct http_ctx *h, bool *write, bool *close); int http_response_add_header(struct http_response *r, const char *header, const char *value); -char *http_cookie_create(const char *key, const char *value); +char *http_cookie_create(const char *key, const char *value, + const struct tm *exp); char *http_encode_url(const char *url); int http_decode_url(const char *url, bool spaces, char **out); -- cgit v1.2.3