Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_http_cookie.c File Reference

Server-side cookies (see n_http_cookie.h). More...

#include "nilorea/n_http_cookie.h"
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include "nilorea/n_str.h"
#include <stdio.h>
#include <string.h>
Include dependency graph for n_http_cookie.c:

Go to the source code of this file.

Functions

static int _cookie_domain_ok (const char *d)
static int _cookie_octet (unsigned char c)
static int _cookie_path_ok (const char *p)
static size_t _cookie_scan (const char *h, size_t len, const char *name, const char **first, size_t *first_len)
static int _cookie_tchar (unsigned char c)
static int _cookie_token (const char *s, size_t n)
size_t n_http_cookie_count (const char *header, size_t len, const char *name)
 count the pairs named name in a Cookie header value
const char * n_http_cookie_get (const char *header, size_t len, const char *name, size_t *value_len)
 find a cookie in a Cookie header value (first occurrence wins)
int n_http_set_cookie_build (N_STR **out, const N_HTTP_SET_COOKIE *c)
 append a Set-Cookie header value, refusing anything that could break out of an attribute or that a browser would reject for its prefix

Detailed Description

Server-side cookies (see n_http_cookie.h).

Author
Castagnier Mickael
Version
1.0
Date
2026

Definition in file n_http_cookie.c.

Function Documentation

◆ _cookie_domain_ok()

int _cookie_domain_ok ( const char * d)
static

Definition at line 149 of file n_http_cookie.c.

Referenced by n_http_set_cookie_build().

Here is the caller graph for this function:

◆ _cookie_octet()

int _cookie_octet ( unsigned char c)
static

Definition at line 55 of file n_http_cookie.c.

Referenced by n_http_set_cookie_build().

Here is the caller graph for this function:

◆ _cookie_path_ok()

int _cookie_path_ok ( const char * p)
static

Definition at line 138 of file n_http_cookie.c.

Referenced by n_http_set_cookie_build().

Here is the caller graph for this function:

◆ _cookie_scan()

size_t _cookie_scan ( const char * h,
size_t len,
const char * name,
const char ** first,
size_t * first_len )
static

Definition at line 62 of file n_http_cookie.c.

References _cookie_token(), eq(), and h().

Referenced by n_http_cookie_count(), and n_http_cookie_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _cookie_tchar()

int _cookie_tchar ( unsigned char c)
static

Definition at line 38 of file n_http_cookie.c.

Referenced by _cookie_token().

Here is the caller graph for this function:

◆ _cookie_token()

int _cookie_token ( const char * s,
size_t n )
static

Definition at line 44 of file n_http_cookie.c.

References _cookie_tchar().

Referenced by _cookie_scan(), and n_http_set_cookie_build().

Here is the call graph for this function:
Here is the caller graph for this function: