proxygen
|
#include <sys/types.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | http_parser |
struct | http_parser_settings |
struct | http_parser_url |
Macros | |
#define | HTTP_PARSER_VERSION_MAJOR 1 |
#define | HTTP_PARSER_VERSION_MINOR 0 |
#define | HTTP_PARSER_STRICT 0 |
#define | HTTP_PARSER_DEBUG 0 |
#define | HTTP_MAX_HEADER_SIZE (80*1024) |
#define | HTTP_ERRNO_MAP(XX) |
#define | HTTP_ERRNO_GEN(n, s) HPE_##n, |
#define | HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno) |
#define | HTTP_PARSER_ERRNO_LINE(p) 0 |
Typedefs | |
typedef struct http_parser | http_parser |
typedef struct http_parser_settings | http_parser_settings |
typedef struct http_parser_result | http_parser_result |
typedef int(* | http_data_cb) (http_parser *, const char *at, size_t length) |
typedef int(* | http_cb) (http_parser *) |
Functions | |
void | http_parser_init (http_parser *parser, enum http_parser_type type) |
size_t | http_parser_execute (http_parser *parser, const http_parser_settings *settings, const char *data, size_t len) |
const char * | http_method_str (enum http_method m) |
const char * | http_errno_name (enum http_errno err) |
const char * | http_errno_description (enum http_errno err) |
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) |
#define HTTP_ERRNO_GEN | ( | n, | |
s | |||
) | HPE_##n, |
Definition at line 195 of file http_parser.h.
#define HTTP_ERRNO_MAP | ( | XX | ) |
Definition at line 139 of file http_parser.h.
#define HTTP_MAX_HEADER_SIZE (80*1024) |
Definition at line 64 of file http_parser.h.
Referenced by http_parser_execute().
#define HTTP_PARSER_DEBUG 0 |
Definition at line 59 of file http_parser.h.
#define HTTP_PARSER_ERRNO | ( | p | ) | ((enum http_errno) (p)->http_errno) |
Definition at line 202 of file http_parser.h.
Referenced by http_parser_execute(), http_parser_pause(), proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::onIngressEOF(), proxygen::HTTP1xCodec::onParserError(), print_error(), proxygen::HTTP1xCodec::setParserPaused(), test_header_overflow_error(), test_message_pause(), and test_simple().
#define HTTP_PARSER_ERRNO_LINE | ( | p | ) | 0 |
Definition at line 208 of file http_parser.h.
Referenced by print_error().
#define HTTP_PARSER_STRICT 0 |
Definition at line 52 of file http_parser.h.
#define HTTP_PARSER_VERSION_MAJOR 1 |
Definition at line 24 of file http_parser.h.
#define HTTP_PARSER_VERSION_MINOR 0 |
Definition at line 25 of file http_parser.h.
typedef int(* http_cb) (http_parser *) |
Definition at line 86 of file http_parser.h.
typedef int(* http_data_cb) (http_parser *, const char *at, size_t length) |
Definition at line 85 of file http_parser.h.
typedef struct http_parser http_parser |
Definition at line 67 of file http_parser.h.
typedef struct http_parser_result http_parser_result |
Definition at line 69 of file http_parser.h.
typedef struct http_parser_settings http_parser_settings |
Definition at line 68 of file http_parser.h.
enum flags |
Enumerator | |
---|---|
F_CHUNKED | |
F_TRAILING | |
F_UPGRADE | |
F_SKIPBODY |
Definition at line 127 of file http_parser.h.
enum http_errno |
Definition at line 196 of file http_parser.h.
enum http_method |
Definition at line 90 of file http_parser.h.
enum http_parser_type |
Enumerator | |
---|---|
HTTP_REQUEST | |
HTTP_RESPONSE | |
HTTP_BOTH |
Definition at line 123 of file http_parser.h.
Enumerator | |
---|---|
UF_SCHEMA | |
UF_HOST | |
UF_PORT | |
UF_PATH | |
UF_QUERY | |
UF_FRAGMENT | |
UF_USERINFO | |
UF_MAX |
Definition at line 263 of file http_parser.h.
const char* http_errno_description | ( | enum http_errno | err | ) |
Definition at line 2186 of file http_parser.c.
References http_strerror_tab.
Referenced by proxygen::HTTP1xCodec::onParserError(), and print_error().
const char* http_errno_name | ( | enum http_errno | err | ) |
Definition at line 2180 of file http_parser.c.
References http_strerror_tab.
Referenced by test_simple().
const char* http_method_str | ( | enum http_method | m | ) |
Definition at line 2159 of file http_parser.c.
References m.
Referenced by proxygen::HTTP1xCodec::onHeadersComplete().
size_t http_parser_execute | ( | http_parser * | parser, |
const http_parser_settings * | settings, | ||
const char * | data, | ||
size_t | len | ||
) |
Definition at line 602 of file http_parser.c.
References _CALLBACK_DATA, BS, c, CALLBACK_DATA, CALLBACK_DATA_NOADVANCE, CALLBACK_NOTIFY, CALLBACK_NOTIFY_NOADVANCE, CALLBACK_SPACE, ch, CHUNKED, CONTENT_LENGTH, http_parser::content_length, CR, data, folly::pushmi::operators::error(), F_CHUNKED, F_SKIPBODY, F_TRAILING, F_UPGRADE, http_parser::flags, h_content_length, h_general, h_general_and_quote, h_general_and_quote_and_escape, h_matching_content_length, h_matching_transfer_encoding, h_matching_transfer_encoding_chunked, h_matching_upgrade, h_transfer_encoding, h_transfer_encoding_chunked, h_upgrade, http_parser::header_state, HPE_CB_headers_complete, HPE_HEADER_OVERFLOW, HPE_HUGE_CHUNK_SIZE, HPE_HUGE_CONTENT_LENGTH, HPE_INVALID_CHUNK_SIZE, HPE_INVALID_CONSTANT, HPE_INVALID_CONTENT_LENGTH, HPE_INVALID_EOF_STATE, HPE_INVALID_FRAGMENT, HPE_INVALID_HEADER_TOKEN, HPE_INVALID_HOST, HPE_INVALID_INTERNAL_STATE, HPE_INVALID_METHOD, HPE_INVALID_PATH, HPE_INVALID_PORT, HPE_INVALID_QUERY_STRING, HPE_INVALID_STATUS, HPE_INVALID_TRANSFER_ENCODING, HPE_INVALID_UPGRADE, HPE_INVALID_URL, HPE_INVALID_VERSION, HPE_LF_EXPECTED, HPE_OK, HPE_STRICT, HPE_UNKNOWN, HTTP_CHECKOUT, HTTP_CONNECT, HTTP_COPY, HTTP_DELETE, http_parser::http_errno, HTTP_GET, HTTP_HEAD, HTTP_LOCK, http_parser::http_major, HTTP_MAX_HEADER_SIZE, HTTP_MERGE, http_parser::http_minor, HTTP_MKACTIVITY, HTTP_MKCOL, HTTP_MOVE, HTTP_MSEARCH, HTTP_NOTIFY, HTTP_OPTIONS, HTTP_PARSER_ERRNO, HTTP_PATCH, HTTP_POST, HTTP_PROPFIND, HTTP_PROPPATCH, HTTP_PUT, HTTP_REPORT, HTTP_REQUEST, HTTP_RESPONSE, HTTP_SUBSCRIBE, HTTP_TRACE, HTTP_UNLOCK, HTTP_UNSUBSCRIBE, http_parser::index, int8_t, IS_ALPHA, IS_ALPHANUM, IS_HEADER_CHAR, IS_HEX, IS_HOST_CHAR, IS_NUM, IS_URL_CHAR, LF, LOWER, MARK, http_parser::method, MIN, MOVE_FAST, MOVE_THE_HEAD, NEW_MESSAGE, http_parser::nread, http_parser_settings::on_headers_complete, PARSING_HEADER, QT, RETURN, s_body_identity, s_body_identity_eof, s_chunk_data, s_chunk_data_almost_done, s_chunk_data_done, s_chunk_parameters, s_chunk_size, s_chunk_size_almost_done, s_chunk_size_start, s_header_almost_done, s_header_field, s_header_field_start, s_header_value, s_header_value_lws, s_header_value_start, s_headers_almost_done, s_headers_done, s_message_done, s_pre_start_req, s_pre_start_req_or_res, s_pre_start_res, s_req_first_http_major, s_req_first_http_minor, s_req_fragment, s_req_fragment_start, s_req_host, s_req_host_done, s_req_host_ipv6, s_req_host_start, s_req_http_H, s_req_http_HT, s_req_http_HTT, s_req_http_HTTP, s_req_http_major, s_req_http_minor, s_req_http_start, s_req_line_almost_done, s_req_method, s_req_path, s_req_port, s_req_query_string, s_req_query_string_start, s_req_schema, s_req_schema_slash, s_req_schema_slash_slash, s_req_spaces_before_url, s_res_first_http_major, s_res_first_http_minor, s_res_first_status_code, s_res_H, s_res_HT, s_res_HTT, s_res_HTTP, s_res_http_major, s_res_http_minor, s_res_line_almost_done, s_res_or_resp_H, s_res_status, s_res_status_code, s_start_req, s_start_req_or_res, s_start_res, SET_ERRNO, http_parser::state, http_parser::status_code, STRICT_CHECK, TOKEN, TRANSFER_ENCODING, http_parser::type, uint64_t, UPGRADE, and http_parser::upgrade.
Referenced by proxygen::HTTP1xCodec::onIngress(), proxygen::HTTP1xCodec::onIngressEOF(), parse(), parse_count_body(), parse_pause(), test_header_overflow_error(), and test_no_overflow_long_body().
void http_parser_init | ( | http_parser * | parser, |
enum http_parser_type | type | ||
) |
Definition at line 2166 of file http_parser.c.
References http_parser::flags, HPE_OK, http_parser::http_errno, http_parser::http_major, http_parser::http_minor, HTTP_REQUEST, HTTP_RESPONSE, http_parser::method, http_parser::nread, s_pre_start_req, s_pre_start_req_or_res, s_pre_start_res, http_parser::state, folly::pushmi::detail::t, http_parser::type, and http_parser::upgrade.
Referenced by proxygen::HTTP1xCodec::HTTP1xCodec(), parser_init(), test_header_overflow_error(), and test_no_overflow_long_body().
int http_parser_parse_url | ( | const char * | buf, |
size_t | buflen, | ||
int | is_connect, | ||
struct http_parser_url * | u | ||
) |
Definition at line 2332 of file http_parser.c.
References http_parser_url::field_data, http_parser_url::field_set, http_parse_host(), http_parser_url::len, http_parser_url::off, parse_url_char(), http_parser_url::port, s, s_dead, s_req_fragment, s_req_fragment_start, s_req_path, s_req_query_string, s_req_query_string_start, s_req_schema, s_req_schema_slash, s_req_schema_slash_slash, s_req_server, s_req_server_start, s_req_server_with_at, s_req_spaces_before_url, UF_FRAGMENT, UF_HOST, UF_MAX, UF_PATH, UF_PORT, UF_QUERY, UF_SCHEMA, and uint16_t.
Referenced by proxygen::ParseURL::parse(), and test_parse_url().
void http_parser_pause | ( | http_parser * | parser, |
int | paused | ||
) |
Definition at line 2431 of file http_parser.c.
References HPE_OK, HPE_PAUSED, HTTP_PARSER_ERRNO, and SET_ERRNO.
Referenced by pause_body_cb(), pause_chunk_complete_cb(), pause_chunk_header_cb(), pause_header_field_cb(), pause_header_value_cb(), pause_headers_complete_cb(), pause_message_begin_cb(), pause_message_complete_cb(), pause_request_url_cb(), pause_response_reason_cb(), proxygen::HTTP1xCodec::setParserPaused(), and test_message_pause().