![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Strict percent-decoding, query strings and urlencoded forms (see n_http_form.h). More...
#include "nilorea/n_http_form.h"#include "nilorea/n_common.h"#include "nilorea/n_log.h"#include "nilorea/n_str.h"#include <stdlib.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | _mp_param |
Macros | |
| #define | _MP_PREAMBLE_MAX 1024 |
Functions | |
| static char * | _form_decode_dup (const char *s, size_t len, int flags, size_t *out_len) |
| static size_t | _form_decode_into (const char *s, size_t len, int flags, char *dst) |
| static int | _form_hex (unsigned char c) |
| static int | _mp_bchar (unsigned char c) |
| static size_t | _mp_find_delim (const char *b, size_t len, size_t from, const char *boundary, size_t blen, size_t *after, int *closing) |
| static int | _mp_ieq (const char *s, size_t n, const char *lit) |
| static int | _mp_lc (int c) |
| static int | _mp_next_param (const char *v, size_t n, size_t *pos, _mp_param *p) |
| static int | _mp_part_headers (const char *h, size_t n, N_HTTP_FORM_PART *part) |
| static int | _mp_tchar (unsigned char c) |
| static int | _mp_text_ok (const char *s, size_t n) |
| size_t | n_http_form_count (const N_HTTP_FORM *form, const char *name) |
| number of fields named name (exact, case-sensitive) | |
| void | n_http_form_free (N_HTTP_FORM **form) |
| free a form and set *form to NULL | |
| const char * | n_http_form_get (const N_HTTP_FORM *form, const char *name, size_t *value_len) |
| value of the LAST field named name (PHP semantics) | |
| int | n_http_form_multipart_boundary (const char *content_type, size_t len, char *out) |
| boundary of a multipart/form-data Content-Type, parsed strictly | |
| size_t | n_http_form_multipart_count (const N_HTTP_FORM_MULTIPART *mp, const char *name) |
| number of parts named name | |
| void | n_http_form_multipart_free (N_HTTP_FORM_MULTIPART **mp) |
| free a parsed body and set *mp to NULL | |
| const N_HTTP_FORM_PART * | n_http_form_multipart_get (const N_HTTP_FORM_MULTIPART *mp, const char *name) |
| the LAST part named name (PHP semantics) | |
| N_HTTP_FORM_MULTIPART * | n_http_form_multipart_parse (const char *buf, size_t len, const char *boundary, size_t max_parts) |
| parse a multipart/form-data body strictly, without copying it | |
| N_HTTP_FORM * | n_http_form_parse (const char *s, size_t len, size_t max_fields, int flags) |
| decode a query string or an urlencoded body into fields | |
| int | n_http_percent_decode (const char *s, size_t len, int flags, N_STR **out) |
| percent-decode [s, s+len), appending to *out; malformed escapes, a decoded NUL and (without N_HTTP_FORM_RAW_BYTES) ill-formed UTF-8 refused | |
Strict percent-decoding, query strings and urlencoded forms (see n_http_form.h).
Definition in file n_http_form.c.
| struct _mp_param |
Definition at line 285 of file n_http_form.c.
| Data Fields | ||
|---|---|---|
| const char * | name | |
| size_t | name_len | |
| char | value[255+2] | |
| size_t | value_len | |
| #define _MP_PREAMBLE_MAX 1024 |
Definition at line 254 of file n_http_form.c.
Referenced by n_http_form_multipart_parse().
|
static |
Definition at line 77 of file n_http_form.c.
References __n_assert, _form_decode_into(), Free, Malloc, N_HTTP_FORM_RAW_BYTES, and n_str_utf8_valid().
Referenced by n_http_form_parse(), and n_http_percent_decode().
|
static |
Definition at line 51 of file n_http_form.c.
References _form_hex(), and N_HTTP_FORM_PLUS_SPACE.
Referenced by _form_decode_dup().
|
static |
Definition at line 39 of file n_http_form.c.
Referenced by _form_decode_into().
|
static |
Definition at line 278 of file n_http_form.c.
Referenced by n_http_form_multipart_boundary().
|
static |
Definition at line 402 of file n_http_form.c.
Referenced by n_http_form_multipart_parse().
|
static |
Definition at line 261 of file n_http_form.c.
References _mp_lc().
Referenced by _mp_part_headers(), and n_http_form_multipart_boundary().
|
static |
Definition at line 256 of file n_http_form.c.
Referenced by _mp_ieq().
|
static |
Definition at line 295 of file n_http_form.c.
References _mp_tchar(), _mp_param::name, _mp_param::name_len, _mp_param::value, and _mp_param::value_len.
Referenced by _mp_part_headers(), and n_http_form_multipart_boundary().
|
static |
Definition at line 427 of file n_http_form.c.
References _mp_ieq(), _mp_next_param(), _mp_tchar(), _mp_text_ok(), N_HTTP_FORM_PART::content_type, N_HTTP_FORM_PART::filename, h(), N_HTTP_FORM_PART::has_filename, le(), N_HTTP_FORM_PART_FILENAME_MAX, N_HTTP_FORM_PART_NAME_MAX, N_HTTP_FORM_PART_TYPE_MAX, _mp_param::name, N_HTTP_FORM_PART::name, _mp_param::name_len, _mp_param::value, and _mp_param::value_len.
Referenced by n_http_form_multipart_parse().
|
static |
Definition at line 271 of file n_http_form.c.
Referenced by _mp_next_param(), and _mp_part_headers().
|
static |
Definition at line 388 of file n_http_form.c.
References n_str_utf8_valid().
Referenced by _mp_part_headers().