HTTP_COOKIE_CREATE(3)

NAME
http_cookie_create - creates a HTTP/1.1 cookie

SYNOPSIS

#include <slweb/http.h>

char *http_cookie_create(const char *key, const char *value);

DESCRIPTION
The http_cookie_create() function allocates a null-terminated string with a HTTP/1.1 cookie defined by key and value, which are null-terminated strings.

RETURN VALUE
On success, a null-terminated string with the newly HTTP/1.1 cookie is returned. Otherwise, a null pointer is returned.

ERRORS
No errors are defined.

EXAMPLE
A successful call to http_cookie_create(3) with ExampleValue as key and ExampleValue as value might return a null-terminated string such as the one below:

    ExampleHeader=ExampleValue; HttpOnly; Expires Wed, 07 Sep 2023 00:00:00 GMT

FUTURE DIRECTIONS
slweb sets a 1-year expiration date for HTTP cookies due to arbitrary design limitations. Future versions of this library shall allow a custom expiration date as an additional parameter to http_cookie_create(3).

SEE ALSO
slweb_http(7).

COPYRIGHT
Copyright (C) 2023 Xavier Del Campo Romero.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.