mirror of
https://github.com/jorisvink/kore
synced 2025-03-09 12:39:01 -04:00
change type of maxage.
This commit is contained in:
parent
4db51d7846
commit
3ae9bb7ae9
@ -38,11 +38,11 @@ serve_cookies(struct http_request *req)
|
||||
|
||||
/* no expire, no maxage for current path. */
|
||||
http_response_cookie(req, "Simple", "Hello World!",
|
||||
req->path, 0, -1, NULL);
|
||||
req->path, 0, 0, NULL);
|
||||
|
||||
/* expire, no maxage, for /secure. */
|
||||
http_response_cookie(req, "Complex", "Secure Value!", "/secure",
|
||||
time(NULL) + (1 * 60 * 60), -1, NULL);
|
||||
time(NULL) + (1 * 60 * 60), 0, NULL);
|
||||
|
||||
/* maxage, no httponly, for current path. */
|
||||
http_response_cookie(req, "key", "value", req->path, 0, 60, &cookie);
|
||||
|
@ -75,7 +75,7 @@ struct http_cookie {
|
||||
char *value;
|
||||
char *path;
|
||||
char *domain;
|
||||
int maxage;
|
||||
u_int32_t maxage;
|
||||
time_t expires;
|
||||
u_int16_t flags;
|
||||
|
||||
@ -269,7 +269,7 @@ int http_state_run(struct http_state *, u_int8_t,
|
||||
int http_request_cookie(struct http_request *,
|
||||
const char *, char **);
|
||||
void http_response_cookie(struct http_request *, const char *,
|
||||
const char *, const char *, time_t, int,
|
||||
const char *, const char *, time_t, u_int32_t,
|
||||
struct http_cookie **);
|
||||
|
||||
int http_argument_urldecode(char *);
|
||||
|
@ -1019,7 +1019,7 @@ http_file_rewind(struct http_file *file)
|
||||
|
||||
void
|
||||
http_response_cookie(struct http_request *req, const char *name,
|
||||
const char *val, const char *path, time_t expires, int maxage,
|
||||
const char *val, const char *path, time_t expires, u_int32_t maxage,
|
||||
struct http_cookie **out)
|
||||
{
|
||||
struct http_cookie *ck;
|
||||
@ -1672,8 +1672,8 @@ http_write_response_cookie(struct http_cookie *ck)
|
||||
kore_buf_appendf(ckhdr_buf, "; Expires=%s", expires);
|
||||
}
|
||||
|
||||
if (ck->maxage != -1)
|
||||
kore_buf_appendf(ckhdr_buf, "; Max-Age=%d", ck->maxage);
|
||||
if (ck->maxage > 0)
|
||||
kore_buf_appendf(ckhdr_buf, "; Max-Age=%u", ck->maxage);
|
||||
|
||||
if (ck->flags & HTTP_COOKIE_HTTPONLY)
|
||||
kore_buf_appendf(ckhdr_buf, "; HttpOnly");
|
||||
|
Loading…
x
Reference in New Issue
Block a user