tcpflow  1.6.1
About: tcpflow is a TCP/IP packet demultiplexer that captures data transmitted as part of TCP connections (flows), and stores the data in a way that is convenient for protocol analysis and debugging.
  Fossies Dox: tcpflow-1.6.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

http_parser.c File Reference
#include "http_parser.h"
#include <assert.h>
#include <stddef.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
Include dependency graph for http_parser.c:

Go to the source code of this file.

Macros

#define ULLONG_MAX   ((uint64_t) -1) /* 2^64-1 */
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define ARRAY_SIZE(a)   (sizeof(a) / sizeof((a)[0]))
 
#define BIT_AT(a, i)
 
#define ELEM_AT(a, i, v)   ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v))
 
#define SET_ERRNO(e)
 
#define CURRENT_STATE()   p_state
 
#define UPDATE_STATE(V)   p_state = (enum state) (V);
 
#define RETURN(V)
 
#define REEXECUTE()    goto reexecute; \
 
#define LIKELY(X)   (X)
 
#define UNLIKELY(X)   (X)
 
#define CALLBACK_NOTIFY_(FOR, ER)
 
#define CALLBACK_NOTIFY(FOR)   CALLBACK_NOTIFY_(FOR, p - data + 1)
 
#define CALLBACK_NOTIFY_NOADVANCE(FOR)   CALLBACK_NOTIFY_(FOR, p - data)
 
#define CALLBACK_DATA_(FOR, LEN, ER)
 
#define CALLBACK_DATA(FOR)    CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1)
 
#define CALLBACK_DATA_NOADVANCE(FOR)    CALLBACK_DATA_(FOR, p - FOR##_mark, p - data)
 
#define MARK(FOR)
 
#define COUNT_HEADER_SIZE(V)
 
#define PROXY_CONNECTION   "proxy-connection"
 
#define CONNECTION   "connection"
 
#define CONTENT_LENGTH   "content-length"
 
#define TRANSFER_ENCODING   "transfer-encoding"
 
#define UPGRADE   "upgrade"
 
#define CHUNKED   "chunked"
 
#define KEEP_ALIVE   "keep-alive"
 
#define CLOSE   "close"
 
#define XX(num, name, string)   #string,
 
#define T(v)   0
 
#define PARSING_HEADER(state)   (state <= s_headers_done)
 
#define CR   '\r'
 
#define LF   '\n'
 
#define LOWER(c)   (unsigned char)(c | 0x20)
 
#define IS_ALPHA(c)   (LOWER(c) >= 'a' && LOWER(c) <= 'z')
 
#define IS_NUM(c)   ((c) >= '0' && (c) <= '9')
 
#define IS_ALPHANUM(c)   (IS_ALPHA(c) || IS_NUM(c))
 
#define IS_HEX(c)   (IS_NUM(c) || (LOWER(c) >= 'a' && LOWER(c) <= 'f'))
 
#define IS_MARK(c)
 
#define IS_USERINFO_CHAR(c)
 
#define STRICT_TOKEN(c)   (tokens[(unsigned char)c])
 
#define TOKEN(c)   (tokens[(unsigned char)c])
 
#define IS_URL_CHAR(c)   (BIT_AT(normal_url_char, (unsigned char)c))
 
#define IS_HOST_CHAR(c)   (IS_ALPHANUM(c) || (c) == '.' || (c) == '-')
 
#define IS_HEADER_CHAR(ch)    (ch == CR || ch == LF || ch == 9 || ((unsigned char)ch > 31 && ch != 127))
 
#define start_state   (parser->type == HTTP_REQUEST ? s_start_req : s_start_res)
 
#define STRICT_CHECK(cond)
 
#define NEW_MESSAGE()   (http_should_keep_alive(parser) ? start_state : s_dead)
 
#define HTTP_STRERROR_GEN(n, s)   { "HPE_" #n, s },
 
#define XX(meth, pos, ch, new_meth)
 

Enumerations

enum  state {
  s_dead = 1 , s_start_req_or_res , s_res_or_resp_H , s_start_res ,
  s_res_H , s_res_HT , s_res_HTT , s_res_HTTP ,
  s_res_http_major , s_res_http_dot , s_res_http_minor , s_res_http_end ,
  s_res_first_status_code , s_res_status_code , s_res_status_start , s_res_status ,
  s_res_line_almost_done , s_start_req , s_req_method , s_req_spaces_before_url ,
  s_req_schema , s_req_schema_slash , s_req_schema_slash_slash , s_req_server_start ,
  s_req_server , s_req_server_with_at , s_req_path , s_req_query_string_start ,
  s_req_query_string , s_req_fragment_start , s_req_fragment , s_req_http_start ,
  s_req_http_H , s_req_http_HT , s_req_http_HTT , s_req_http_HTTP ,
  s_req_http_major , s_req_http_dot , s_req_http_minor , s_req_http_end ,
  s_req_line_almost_done , s_header_field_start , s_header_field , s_header_value_discard_ws ,
  s_header_value_discard_ws_almost_done , s_header_value_discard_lws , s_header_value_start , s_header_value ,
  s_header_value_lws , s_header_almost_done , s_chunk_size_start , s_chunk_size ,
  s_chunk_parameters , s_chunk_size_almost_done , s_headers_almost_done , s_headers_done ,
  s_chunk_data , s_chunk_data_almost_done , s_chunk_data_done , s_body_identity ,
  s_body_identity_eof , s_message_done
}
 
enum  header_states {
  h_general = 0 , h_C , h_CO , h_CON ,
  h_matching_connection , h_matching_proxy_connection , h_matching_content_length , h_matching_transfer_encoding ,
  h_matching_upgrade , h_connection , h_content_length , h_transfer_encoding ,
  h_upgrade , h_matching_transfer_encoding_chunked , h_matching_connection_token_start , h_matching_connection_keep_alive ,
  h_matching_connection_close , h_matching_connection_upgrade , h_matching_connection_token , h_transfer_encoding_chunked ,
  h_connection_keep_alive , h_connection_close , h_connection_upgrade
}
 
enum  http_host_state {
  s_http_host_dead = 1 , s_http_userinfo_start , s_http_userinfo , s_http_host_start ,
  s_http_host_v6_start , s_http_host , s_http_host_v6 , s_http_host_v6_end ,
  s_http_host_v6_zone_start , s_http_host_v6_zone , s_http_host_port_start , s_http_host_port
}
 

Functions

int http_message_needs_eof (const http_parser *parser)
 
static enum state parse_url_char (enum state s, const char ch)
 
size_t http_parser_execute (http_parser *parser, const http_parser_settings *settings, const char *data, size_t len)
 
int http_should_keep_alive (const http_parser *parser)
 
const char * http_method_str (enum http_method m)
 
void http_parser_init (http_parser *parser, enum http_parser_type t)
 
void http_parser_settings_init (http_parser_settings *settings)
 
const char * http_errno_name (enum http_errno err)
 
const char * http_errno_description (enum http_errno err)
 
static enum http_host_state http_parse_host_char (enum http_host_state s, const char ch)
 
static int http_parse_host (const char *buf, struct http_parser_url *u, int found_at)
 
void http_parser_url_init (struct http_parser_url *u)
 
int http_parser_parse_url (const char *buf, size_t buflen, int is_connect, struct http_parser_url *u)
 
void http_parser_pause (http_parser *parser, int paused)
 
int http_body_is_final (const struct http_parser *parser)
 
unsigned long http_parser_version (void)
 

Variables

static const char * method_strings []
 
static const char tokens [256]
 
static const int8_t unhex [256]
 
static const uint8_t normal_url_char [32]
 
struct {
   const char *   name
 
   const char *   description
 
http_strerror_tab []
 

Macro Definition Documentation

◆ ARRAY_SIZE

#define ARRAY_SIZE (   a)    (sizeof(a) / sizeof((a)[0]))

Definition at line 41 of file http_parser.c.

◆ BIT_AT

#define BIT_AT (   a,
 
)
Value:
(!!((unsigned int) (a)[(unsigned int) (i) >> 3] & \
(1 << ((unsigned int) (i) & 7))))

Definition at line 45 of file http_parser.c.

◆ CALLBACK_DATA

#define CALLBACK_DATA (   FOR)     CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1)

Definition at line 128 of file http_parser.c.

◆ CALLBACK_DATA_

#define CALLBACK_DATA_ (   FOR,
  LEN,
  ER 
)
Value:
do { \
assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \
\
if (FOR##_mark) { \
if (LIKELY(settings->on_##FOR)) { \
parser->state = CURRENT_STATE(); \
if (UNLIKELY(0 != \
settings->on_##FOR(parser, FOR##_mark, (LEN)))) { \
SET_ERRNO(HPE_CB_##FOR); \
} \
UPDATE_STATE(parser->state); \
\
/* We either errored above or got paused; get out */ \
if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \
return (ER); \
} \
} \
FOR##_mark = NULL; \
} \
} while (0)
#define CURRENT_STATE()
Definition: http_parser.c:59
#define UNLIKELY(X)
Definition: http_parser.c:75
#define LIKELY(X)
Definition: http_parser.c:74
@ HPE_OK
Definition: http_parser.h:280
#define HTTP_PARSER_ERRNO(p)
Definition: http_parser.h:285

Definition at line 105 of file http_parser.c.

◆ CALLBACK_DATA_NOADVANCE

#define CALLBACK_DATA_NOADVANCE (   FOR)     CALLBACK_DATA_(FOR, p - FOR##_mark, p - data)

Definition at line 132 of file http_parser.c.

◆ CALLBACK_NOTIFY

#define CALLBACK_NOTIFY (   FOR)    CALLBACK_NOTIFY_(FOR, p - data + 1)

Definition at line 99 of file http_parser.c.

◆ CALLBACK_NOTIFY_

#define CALLBACK_NOTIFY_ (   FOR,
  ER 
)
Value:
do { \
assert(HTTP_PARSER_ERRNO(parser) == HPE_OK); \
\
if (LIKELY(settings->on_##FOR)) { \
parser->state = CURRENT_STATE(); \
if (UNLIKELY(0 != settings->on_##FOR(parser))) { \
SET_ERRNO(HPE_CB_##FOR); \
} \
UPDATE_STATE(parser->state); \
\
/* We either errored above or got paused; get out */ \
if (UNLIKELY(HTTP_PARSER_ERRNO(parser) != HPE_OK)) { \
return (ER); \
} \
} \
} while (0)

Definition at line 80 of file http_parser.c.

◆ CALLBACK_NOTIFY_NOADVANCE

#define CALLBACK_NOTIFY_NOADVANCE (   FOR)    CALLBACK_NOTIFY_(FOR, p - data)

Definition at line 102 of file http_parser.c.

◆ CHUNKED

#define CHUNKED   "chunked"

Definition at line 169 of file http_parser.c.

◆ CLOSE

#define CLOSE   "close"

Definition at line 171 of file http_parser.c.

◆ CONNECTION

#define CONNECTION   "connection"

Definition at line 165 of file http_parser.c.

◆ CONTENT_LENGTH

#define CONTENT_LENGTH   "content-length"

Definition at line 166 of file http_parser.c.

◆ COUNT_HEADER_SIZE

#define COUNT_HEADER_SIZE (   V)
Value:
do { \
parser->nread += (V); \
if (UNLIKELY(parser->nread > (HTTP_MAX_HEADER_SIZE))) { \
SET_ERRNO(HPE_HEADER_OVERFLOW); \
goto error; \
} \
} while (0)
@ HPE_HEADER_OVERFLOW
Definition: http_parser.h:280
#define HTTP_MAX_HEADER_SIZE
Definition: http_parser.h:63

Definition at line 154 of file http_parser.c.

◆ CR

#define CR   '\r'

Definition at line 409 of file http_parser.c.

◆ CURRENT_STATE

#define CURRENT_STATE ( )    p_state

Definition at line 59 of file http_parser.c.

◆ ELEM_AT

#define ELEM_AT (   a,
  i,
 
)    ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v))

Definition at line 51 of file http_parser.c.

◆ HTTP_STRERROR_GEN

#define HTTP_STRERROR_GEN (   n,
 
)    { "HPE_" #n, s },

Definition at line 463 of file http_parser.c.

◆ IS_ALPHA

#define IS_ALPHA (   c)    (LOWER(c) >= 'a' && LOWER(c) <= 'z')

Definition at line 412 of file http_parser.c.

◆ IS_ALPHANUM

#define IS_ALPHANUM (   c)    (IS_ALPHA(c) || IS_NUM(c))

Definition at line 414 of file http_parser.c.

◆ IS_HEADER_CHAR

#define IS_HEADER_CHAR (   ch)     (ch == CR || ch == LF || ch == 9 || ((unsigned char)ch > 31 && ch != 127))

Verify that a char is a valid visible (printable) US-ASCII character or x80-FF

Definition at line 441 of file http_parser.c.

◆ IS_HEX

#define IS_HEX (   c)    (IS_NUM(c) || (LOWER(c) >= 'a' && LOWER(c) <= 'f'))

Definition at line 415 of file http_parser.c.

◆ IS_HOST_CHAR

#define IS_HOST_CHAR (   c)    (IS_ALPHANUM(c) || (c) == '.' || (c) == '-')

Definition at line 428 of file http_parser.c.

◆ IS_MARK

#define IS_MARK (   c)
Value:
((c) == '-' || (c) == '_' || (c) == '.' || \
(c) == '!' || (c) == '~' || (c) == '*' || (c) == '\'' || (c) == '(' || \
(c) == ')')
int c
Definition: tcpdemux.cpp:366

Definition at line 416 of file http_parser.c.

◆ IS_NUM

#define IS_NUM (   c)    ((c) >= '0' && (c) <= '9')

Definition at line 413 of file http_parser.c.

◆ IS_URL_CHAR

#define IS_URL_CHAR (   c)    (BIT_AT(normal_url_char, (unsigned char)c))

Definition at line 427 of file http_parser.c.

◆ IS_USERINFO_CHAR

#define IS_USERINFO_CHAR (   c)
Value:
(IS_ALPHANUM(c) || IS_MARK(c) || (c) == '%' || \
(c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \
(c) == '$' || (c) == ',')
#define IS_ALPHANUM(c)
Definition: http_parser.c:414
#define IS_MARK(c)
Definition: http_parser.c:416

Definition at line 419 of file http_parser.c.

◆ KEEP_ALIVE

#define KEEP_ALIVE   "keep-alive"

Definition at line 170 of file http_parser.c.

◆ LF

#define LF   '\n'

Definition at line 410 of file http_parser.c.

◆ LIKELY

#define LIKELY (   X)    (X)

Definition at line 74 of file http_parser.c.

◆ LOWER

#define LOWER (   c)    (unsigned char)(c | 0x20)

Definition at line 411 of file http_parser.c.

◆ MARK

#define MARK (   FOR)
Value:
do { \
if (!FOR##_mark) { \
FOR##_mark = p; \
} \
} while (0)

Definition at line 136 of file http_parser.c.

◆ MIN

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

Definition at line 37 of file http_parser.c.

◆ NEW_MESSAGE

#define NEW_MESSAGE ( )    (http_should_keep_alive(parser) ? start_state : s_dead)

Definition at line 455 of file http_parser.c.

◆ PARSING_HEADER

#define PARSING_HEADER (   state)    (state <= s_headers_done)

Definition at line 359 of file http_parser.c.

◆ PROXY_CONNECTION

#define PROXY_CONNECTION   "proxy-connection"

Definition at line 164 of file http_parser.c.

◆ REEXECUTE

#define REEXECUTE ( )     goto reexecute; \

Definition at line 66 of file http_parser.c.

◆ RETURN

#define RETURN (   V)
Value:
do { \
parser->state = CURRENT_STATE(); \
return (V); \
} while (0);

Definition at line 61 of file http_parser.c.

◆ SET_ERRNO

#define SET_ERRNO (   e)
Value:
do { \
parser->http_errno = (e); \
} while(0)

Definition at line 54 of file http_parser.c.

◆ start_state

#define start_state   (parser->type == HTTP_REQUEST ? s_start_req : s_start_res)

Definition at line 444 of file http_parser.c.

◆ STRICT_CHECK

#define STRICT_CHECK (   cond)
Value:
do { \
if (cond) { \
SET_ERRNO(HPE_STRICT); \
goto error; \
} \
} while (0)
@ HPE_STRICT
Definition: http_parser.h:280

Definition at line 448 of file http_parser.c.

◆ STRICT_TOKEN

#define STRICT_TOKEN (   c)    (tokens[(unsigned char)c])

Definition at line 423 of file http_parser.c.

◆ T

#define T (   v)    0

Definition at line 236 of file http_parser.c.

◆ TOKEN

#define TOKEN (   c)    (tokens[(unsigned char)c])

Definition at line 426 of file http_parser.c.

◆ TRANSFER_ENCODING

#define TRANSFER_ENCODING   "transfer-encoding"

Definition at line 167 of file http_parser.c.

◆ ULLONG_MAX

#define ULLONG_MAX   ((uint64_t) -1) /* 2^64-1 */

Definition at line 33 of file http_parser.c.

◆ UNLIKELY

#define UNLIKELY (   X)    (X)

Definition at line 75 of file http_parser.c.

◆ UPDATE_STATE

#define UPDATE_STATE (   V)    p_state = (enum state) (V);

Definition at line 60 of file http_parser.c.

◆ UPGRADE

#define UPGRADE   "upgrade"

Definition at line 168 of file http_parser.c.

◆ XX [1/2]

#define XX (   meth,
  pos,
  ch,
  new_meth 
)
Value:
case (HTTP_##meth << 16 | pos << 8 | ch): \
parser->method = HTTP_##new_meth; break;

◆ XX [2/2]

#define XX (   num,
  name,
  string 
)    #string,

Enumeration Type Documentation

◆ header_states

Enumerator
h_general 
h_C 
h_CO 
h_CON 
h_matching_connection 
h_matching_proxy_connection 
h_matching_content_length 
h_matching_transfer_encoding 
h_matching_upgrade 
h_connection 
h_content_length 
h_transfer_encoding 
h_upgrade 
h_matching_transfer_encoding_chunked 
h_matching_connection_token_start 
h_matching_connection_keep_alive 
h_matching_connection_close 
h_matching_connection_upgrade 
h_matching_connection_token 
h_transfer_encoding_chunked 
h_connection_keep_alive 
h_connection_close 
h_connection_upgrade 

Definition at line 362 of file http_parser.c.

◆ http_host_state

Enumerator
s_http_host_dead 
s_http_userinfo_start 
s_http_userinfo 
s_http_host_start 
s_http_host_v6_start 
s_http_host 
s_http_host_v6 
s_http_host_v6_end 
s_http_host_v6_zone_start 
s_http_host_v6_zone 
s_http_host_port_start 
s_http_host_port 

Definition at line 392 of file http_parser.c.

◆ state

enum state
Enumerator
s_dead 
s_start_req_or_res 
s_res_or_resp_H 
s_start_res 
s_res_H 
s_res_HT 
s_res_HTT 
s_res_HTTP 
s_res_http_major 
s_res_http_dot 
s_res_http_minor 
s_res_http_end 
s_res_first_status_code 
s_res_status_code 
s_res_status_start 
s_res_status 
s_res_line_almost_done 
s_start_req 
s_req_method 
s_req_spaces_before_url 
s_req_schema 
s_req_schema_slash 
s_req_schema_slash_slash 
s_req_server_start 
s_req_server 
s_req_server_with_at 
s_req_path 
s_req_query_string_start 
s_req_query_string 
s_req_fragment_start 
s_req_fragment 
s_req_http_start 
s_req_http_H 
s_req_http_HT 
s_req_http_HTT 
s_req_http_HTTP 
s_req_http_major 
s_req_http_dot 
s_req_http_minor 
s_req_http_end 
s_req_line_almost_done 
s_header_field_start 
s_header_field 
s_header_value_discard_ws 
s_header_value_discard_ws_almost_done 
s_header_value_discard_lws 
s_header_value_start 
s_header_value 
s_header_value_lws 
s_header_almost_done 
s_chunk_size_start 
s_chunk_size 
s_chunk_parameters 
s_chunk_size_almost_done 
s_headers_almost_done 
s_headers_done 
s_chunk_data 
s_chunk_data_almost_done 
s_chunk_data_done 
s_body_identity 
s_body_identity_eof 
s_message_done 

Definition at line 278 of file http_parser.c.

Function Documentation

◆ http_body_is_final()

int http_body_is_final ( const struct http_parser parser)

Definition at line 2400 of file http_parser.c.

References s_message_done, and http_parser::state.

◆ http_errno_description()

const char* http_errno_description ( enum http_errno  err)

Definition at line 2107 of file http_parser.c.

References ARRAY_SIZE, err(), and http_strerror_tab.

◆ http_errno_name()

const char* http_errno_name ( enum http_errno  err)

Definition at line 2101 of file http_parser.c.

References ARRAY_SIZE, err(), and http_strerror_tab.

◆ http_message_needs_eof()

int http_message_needs_eof ( const http_parser parser)

◆ http_method_str()

const char* http_method_str ( enum http_method  m)

Definition at line 2077 of file http_parser.c.

References ELEM_AT, and method_strings.

◆ http_parse_host()

◆ http_parse_host_char()

static enum http_host_state http_parse_host_char ( enum http_host_state  s,
const char  ch 
)
static

Definition at line 2107 of file http_parser.c.

Referenced by http_parse_host().

◆ http_parser_execute()

size_t http_parser_execute ( http_parser parser,
const http_parser_settings settings,
const char *  data,
size_t  len 
)

Definition at line 632 of file http_parser.c.

Referenced by scan_http().

◆ http_parser_init()

◆ http_parser_parse_url()

◆ http_parser_pause()

void http_parser_pause ( http_parser parser,
int  paused 
)

Definition at line 2386 of file http_parser.c.

References HPE_OK, HPE_PAUSED, HTTP_PARSER_ERRNO, and SET_ERRNO.

◆ http_parser_settings_init()

void http_parser_settings_init ( http_parser_settings settings)

Definition at line 2095 of file http_parser.c.

◆ http_parser_url_init()

void http_parser_url_init ( struct http_parser_url u)

Definition at line 2277 of file http_parser.c.

◆ http_parser_version()

unsigned long http_parser_version ( void  )

◆ http_should_keep_alive()

int http_should_keep_alive ( const http_parser parser)

◆ parse_url_char()

static enum state parse_url_char ( enum state  s,
const char  ch 
)
static

Definition at line 471 of file http_parser.c.

Referenced by http_parser_parse_url().

Variable Documentation

◆ description

const char* description

Definition at line 466 of file http_parser.c.

◆ 

struct { ... } http_strerror_tab[]
Initial value:
= {
{ "HPE_" "OK", "success" }, { "HPE_" "CB_message_begin", "the on_message_begin callback failed" }, { "HPE_" "CB_url", "the on_url callback failed" }, { "HPE_" "CB_header_field", "the on_header_field callback failed" }, { "HPE_" "CB_header_value", "the on_header_value callback failed" }, { "HPE_" "CB_headers_complete", "the on_headers_complete callback failed" }, { "HPE_" "CB_body", "the on_body callback failed" }, { "HPE_" "CB_message_complete", "the on_message_complete callback failed" }, { "HPE_" "CB_status", "the on_status callback failed" }, { "HPE_" "CB_chunk_header", "the on_chunk_header callback failed" }, { "HPE_" "CB_chunk_complete", "the on_chunk_complete callback failed" }, { "HPE_" "INVALID_EOF_STATE", "stream ended at an unexpected time" }, { "HPE_" "HEADER_OVERFLOW", "too many header bytes seen; overflow detected" }, { "HPE_" "CLOSED_CONNECTION", "data received after completed connection: close message" }, { "HPE_" "INVALID_VERSION", "invalid HTTP version" }, { "HPE_" "INVALID_STATUS", "invalid HTTP status code" }, { "HPE_" "INVALID_METHOD", "invalid HTTP method" }, { "HPE_" "INVALID_URL", "invalid URL" }, { "HPE_" "INVALID_HOST", "invalid host" }, { "HPE_" "INVALID_PORT", "invalid port" }, { "HPE_" "INVALID_PATH", "invalid path" }, { "HPE_" "INVALID_QUERY_STRING", "invalid query string" }, { "HPE_" "INVALID_FRAGMENT", "invalid fragment" }, { "HPE_" "LF_EXPECTED", "LF character expected" }, { "HPE_" "INVALID_HEADER_TOKEN", "invalid character in header" }, { "HPE_" "INVALID_CONTENT_LENGTH", "invalid character in content-length header" }, { "HPE_" "UNEXPECTED_CONTENT_LENGTH", "unexpected content-length header" }, { "HPE_" "INVALID_CHUNK_SIZE", "invalid character in chunk size header" }, { "HPE_" "INVALID_CONSTANT", "invalid constant string" }, { "HPE_" "INVALID_INTERNAL_STATE", "encountered unexpected internal state" }, { "HPE_" "STRICT", "strict mode assertion failed" }, { "HPE_" "PAUSED", "parser is paused" }, { "HPE_" "UNKNOWN", "an unknown error occurred" },}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

Referenced by http_errno_description(), and http_errno_name().

◆ method_strings

const char* method_strings[]
static
Initial value:
=
{
#define XX(num, name, string)
"DELETE", "GET", "HEAD", "POST", "PUT", "CONNECT", "OPTIONS", "TRACE", "COPY", "LOCK", "MKCOL", "MOVE", "PROPFIND", "PROPPATCH", "SEARCH", "UNLOCK", "BIND", "REBIND", "UNBIND", "ACL", "REPORT", "MKACTIVITY", "CHECKOUT", "MERGE", "M-SEARCH", "NOTIFY", "SUBSCRIBE", "UNSUBSCRIBE", "PATCH", "PURGE", "MKCALENDAR", "LINK", "UNLINK",##################################undef XX
}
#define XX(num, name, string)

Definition at line 174 of file http_parser.c.

Referenced by http_method_str().

◆ name

◆ normal_url_char

const uint8_t normal_url_char[32]
static

Definition at line 242 of file http_parser.c.

◆ tokens

const char tokens[256]
static

Definition at line 188 of file http_parser.c.

Referenced by comma_number_string().

◆ unhex

const int8_t unhex[256]
static
Initial value:
=
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1
,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
}

Definition at line 223 of file http_parser.c.