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

HTTP/1.1 request-head parser (see n_http_req.h). More...

#include "nilorea/n_http_req.h"
#include <string.h>
Include dependency graph for n_http_req.c:

Go to the source code of this file.

Functions

static int lc (int c)
const char * n_http_request_header (const n_http_request *req, const char *buf, const char *name, size_t *value_len)
 find a header of a parsed request
size_t n_http_request_header_count (const n_http_request *req, const char *buf, const char *name)
 count the headers of a parsed request that carry a name
n_http_req_status n_http_request_parse (const char *buf, size_t len, n_http_request *out)
 parse an HTTP/1.1 request head from [buf, buf+len)
n_http_req_status n_http_request_parse_ex (const char *buf, size_t len, const n_http_req_limits *limits, n_http_request *out)
 parse an HTTP/1.1 request head with caller-chosen limits
static int name_eq (const char *s, size_t n, const char *lit)
static int name_ieq (const char *a, const char *b, size_t n)
static int name_token_ok (const char *s, size_t n)
static int parse_body_len (const char *s, size_t n, long long max, long long *out)
static int target_ok (unsigned char c)
static int value_ok (const char *s, size_t n)

Detailed Description

HTTP/1.1 request-head parser (see n_http_req.h).

A small, strict scanner, bounded and over-read safe on every path.

Author
Castagnier Mickael
Version
1.0

Definition in file n_http_req.c.

Function Documentation

◆ lc()

int lc ( int c)
static

Definition at line 31 of file n_http_req.c.

Referenced by name_eq(), and name_ieq().

Here is the caller graph for this function:

◆ name_eq()

int name_eq ( const char * s,
size_t n,
const char * lit )
static

Definition at line 37 of file n_http_req.c.

References lc().

Referenced by n_http_request_parse_ex().

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

◆ name_ieq()

int name_ieq ( const char * a,
const char * b,
size_t n )
static

Definition at line 46 of file n_http_req.c.

References lc().

Referenced by n_http_request_header(), and n_http_request_header_count().

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

◆ name_token_ok()

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

Definition at line 58 of file n_http_req.c.

Referenced by n_http_request_parse_ex().

Here is the caller graph for this function:

◆ parse_body_len()

int parse_body_len ( const char * s,
size_t n,
long long max,
long long * out )
static

Definition at line 88 of file n_http_req.c.

Referenced by n_http_request_parse_ex().

Here is the caller graph for this function:

◆ target_ok()

int target_ok ( unsigned char c)
static

Definition at line 106 of file n_http_req.c.

Referenced by n_http_request_parse_ex().

Here is the caller graph for this function:

◆ value_ok()

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

Definition at line 75 of file n_http_req.c.

Referenced by n_http_request_parse_ex().

Here is the caller graph for this function: