![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include "nilorea/n_common.h"#include "nilorea/n_http_cookie.h"#include "nilorea/n_log.h"#include "nilorea/n_str.h"Go to the source code of this file.
Functions | |
| static int | builds (const N_HTTP_SET_COOKIE *c, const char *want) |
| build one Set-Cookie and compare | |
| static int | cookie_is (const char *header, const char *name, const char *want) |
| the cookie name in header has exactly the value want (NULL: absent) | |
| static void | expect_true (const char *what, int ok) |
| count a failed check | |
| int | main (int argc, char **argv) |
| run the checks | |
| static int | process_args (int argc, char **argv) |
| read -V | |
| static void | test_build (void) |
| building Set-Cookie values | |
| static void | test_read (void) |
| reading a Cookie header | |
Variables | |
| static int | failures = 0 |
| failed checks | |
| static int | log_level = 3 |
| log level from -V | |
|
static |
build one Set-Cookie and compare
| c | the cookie |
| want | expected header value, or NULL when building must fail |
Definition at line 112 of file ex_http_cookie.c.
References N_STR::data, free_nstr, LOG_ERR, n_http_set_cookie_build(), and n_log.
Referenced by test_build().
|
static |
the cookie name in header has exactly the value want (NULL: absent)
| header | Cookie header value |
| name | cookie name |
| want | expected value or NULL |
Definition at line 79 of file ex_http_cookie.c.
References n_http_cookie_get().
Referenced by test_read().
|
static |
| int main | ( | int | argc, |
| char ** | argv ) |
run the checks
| argc | argument count |
| argv | arguments |
Definition at line 230 of file ex_http_cookie.c.
References failures, LOG_ERR, log_level, LOG_NOTICE, n_log, process_args(), set_log_level(), test_build(), and test_read().
|
static |
read -V
| argc | argument count |
| argv | arguments |
Definition at line 61 of file ex_http_cookie.c.
References log_level.
|
static |
building Set-Cookie values
Definition at line 123 of file ex_http_cookie.c.
References builds(), char_to_nstr(), N_STR::data, N_HTTP_SET_COOKIE::domain, expect_true(), free_nstr, N_HTTP_SET_COOKIE::http_only, N_HTTP_SET_COOKIE::max_age, N_HTTP_COOKIE_SESSION, N_HTTP_SAMESITE_LAX, N_HTTP_SAMESITE_NONE, N_HTTP_SAMESITE_STRICT, N_HTTP_SAMESITE_UNSET, n_http_set_cookie_build(), N_HTTP_SET_COOKIE::name, N_HTTP_SET_COOKIE::path, N_HTTP_SET_COOKIE::same_site, N_HTTP_SET_COOKIE::secure, and N_HTTP_SET_COOKIE::value.
Referenced by main().
|
static |
reading a Cookie header
Definition at line 88 of file ex_http_cookie.c.
References cookie_is(), expect_true(), h(), n_http_cookie_count(), and n_http_cookie_get().
Referenced by main().
|
static |
failed checks
Definition at line 43 of file ex_http_cookie.c.
|
static |
log level from -V
Definition at line 41 of file ex_http_cookie.c.