aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-02-12 15:55:13 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-02-12 16:10:37 +0100
commit1b2a52d214d92f543c9e0651f56c3292b23655a5 (patch)
treea892b5623895d3a323e982439201488281c08a34 /include
parent424e46f5408776cd36d8258d3cbffa55acf56cc7 (diff)
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.
Diffstat (limited to 'include')
-rw-r--r--include/libweb/http.h4
1 files changed, 3 insertions, 1 deletions
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 <stdbool.h>
#include <stddef.h>
#include <stdio.h>
+#include <time.h>
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);