evhtp.h File Reference
`#include <evhtp/config.h>`
`#include <evhtp/thread.h>`
`#include <evhtp/parser.h>`
`#include <onigposix.h>`
`#include <sys/queue.h>`
`#include <event2/event.h>`
`#include <event2/listener.h>`
`#include <event2/buffer.h>`
`#include <event2/bufferevent.h>`
`#include <event2/bufferevent_ssl.h>`
`#include <openssl/dh.h>`
`#include <openssl/ssl.h>`
`#include <openssl/err.h>`
`#include <openssl/rand.h>`
Include dependency graph for evhtp/evhtp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | evhtp_defaults_t
struct | evhtp_alias_t
struct | evhtp_t
| main structure containing all configuration information More...
struct | evhtp_header_t
| a generic key/value structure More...
struct | evhtp_uri_t
| a generic container representing an entire URI strucutre More...
struct | evhtp_authority_t
| structure which represents authority information in a URI More...
struct | evhtp_path_t
| structure which represents a URI path and or file More...
struct | evhtp_request_t
| a structure containing all information for a http request. More...
struct | evhtp_connection_t
struct | evhtp_hooks_t
struct | evhtp_ssl_cfg_t

## Macros

#define | EVHTP_VERSION "1.2.18"
#define | EVHTP_VERSION_MAJOR 1
#define | EVHTP_VERSION_MINOR 2
#define | EVHTP_VERSION_PATCH 18
#define | evhtp_headers_iterator evhtp_kvs_iterator
#define | EVHTP_RES_ERROR 0
#define | EVHTP_RES_PAUSE 1
#define | EVHTP_RES_FATAL 2
#define | EVHTP_RES_USER 3
#define | EVHTP_RES_DATA_TOO_LONG 4
#define | EVHTP_RES_OK 200
#define | EVHTP_FLAG_ENABLE_100_CONT (1 << 1)
#define | EVHTP_FLAG_ENABLE_REUSEPORT (1 << 2)
#define | EVHTP_FLAG_ENABLE_NODELAY (1 << 3)
#define | EVHTP_FLAG_ENABLE_DEFER_ACCEPT (1 << 4)
#define | EVHTP_FLAG_DEFAULTS EVHTP_FLAG_ENABLE_100_CONT
#define | EVHTP_FLAG_ENABLE_ALL
#define | thread_init_cbarg thread_cbarg
#define | EVHTP_REQ_FLAG_KEEPALIVE (1 << 1)
#define | EVHTP_REQ_FLAG_FINISHED (1 << 2)
#define | EVHTP_REQ_FLAG_CHUNKED (1 << 3)
#define | EVHTP_REQ_FLAG_ERROR (1 << 4)
#define | evhtp_request_content_len(r)
#define | EVHTP_CONN_FLAG_ERROR (1 << 1)
#define | EVHTP_CONN_FLAG_OWNER (1 << 2)
| set to 1 if this structure owns the bufferevent
#define | EVHTP_CONN_FLAG_VHOST_VIA_SNI (1 << 3)
| set to 1 if the vhost was found via SSL SNI
#define | EVHTP_CONN_FLAG_PAUSED (1 << 4)
| this connection has been marked as paused
#define | EVHTP_CONN_FLAG_CONNECTED (1 << 5)
| client specific - set after successful connection
#define | EVHTP_CONN_FLAG_WAITING (1 << 6)
| used to make sure resuming happens AFTER sending a reply
#define | EVHTP_CONN_FLAG_FREE_CONN (1 << 7)
#define | EVHTP_CONN_FLAG_KEEPALIVE (1 << 8)
| set to 1 after the first request has been processed and the connection is kept open
#define | EVHTP_PARSE_QUERY_FLAG_STRICT 0
#define | EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX (1 << 0)
#define | EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS (1 << 1)
#define | EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS (1 << 2)
#define | EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP (1 << 3)
#define | EVHTP_PARSE_QUERY_FLAG_IGNORE_FRAGMENTS (1 << 4)
#define | EVHTP_PARSE_QUERY_FLAG_LENIENT
#define | EVHTP_PARSE_QUERY_FLAG_DEFAULT EVHTP_PARSE_QUERY_FLAG_LENIENT
#define | evhtp_headers_find_header evhtp_kvs_find_kv
#define | evhtp_headers_for_each evhtp_kvs_for_each
#define | evhtp_header_free evhtp_kv_free
#define | evhtp_headers_new evhtp_kvs_new
#define | evhtp_headers_free evhtp_kvs_free
#define | evhtp_header_rm_and_free evhtp_kv_rm_and_free
#define | evhtp_headers_add_headers evhtp_kvs_add_kvs
#define | evhtp_query_new evhtp_kvs_new
#define | evhtp_query_free evhtp_kvs_free
#define | evhtp_safe_free(_var, _freefn)

## Typedefs

typedef SSL_SESSION | evhtp_ssl_sess_t
typedef SSL | evhtp_ssl_t
typedef SSL_CTX | evhtp_ssl_ctx_t
typedef X509 | evhtp_x509_t
typedef X509_STORE_CTX | evhtp_x509_store_ctx_t
typedef unsigned char | evhtp_ssl_data_t
typedef struct evbuffer | evbuf_t
typedef struct event | event_t
typedef struct evconnlistener | evserv_t
typedef struct bufferevent | evbev_t
typedef pthread_mutex_t | evhtp_mutex_t
typedef struct evhtp_callbacks | evhtp_callbacks_t
typedef struct evhtp_kvs | evhtp_kvs_t
typedef uint16_t | evhtp_res
typedef uint8_t | evhtp_error_flags
typedef struct evhtp_kvs | evhtp_headers_t
typedef struct evhtp_kvs | evhtp_query_t
typedef enum evhtp_hook_type | evhtp_hook_type
typedef enum evhtp_callback_type | evhtp_callback_type
typedef enum evhtp_proto | evhtp_proto
typedef enum evhtp_ssl_scache_type | evhtp_ssl_scache_type
typedef enum evhtp_type | evhtp_type
typedef void(* | evhtp_thread_init_cb) (evhtp_t *htp, evthr_t *thr, void *arg)
typedef void(* | evhtp_thread_exit_cb) (evhtp_t *htp, evthr_t *thr, void *arg)
typedef void(* | evhtp_callback_cb) (evhtp_request_t *req, void *arg)
typedef void(* | evhtp_hook_err_cb) (evhtp_request_t *req, evhtp_error_flags errtype, void *arg)
typedef void(* | evhtp_hook_event_cb) (evhtp_connection_t *conn, short events, void *arg)
typedef evhtp_res(* | evhtp_hook) ()
typedef evhtp_res(* | evhtp_hook_conn_err_cb) (evhtp_connection_t *connection, evhtp_error_flags errtype, void *arg)
typedef evhtp_res(* | evhtp_pre_accept_cb) (evhtp_connection_t *conn, void *arg)
typedef evhtp_res(* | evhtp_post_accept_cb) (evhtp_connection_t *conn, void *arg)
typedef evhtp_res(* | evhtp_hook_header_cb) (evhtp_request_t *req, evhtp_header_t *hdr, void *arg)
typedef evhtp_res(* | evhtp_hook_headers_cb) (evhtp_request_t *req, evhtp_headers_t *hdr, void *arg)
typedef evhtp_res(* | evhtp_hook_path_cb) (evhtp_request_t *req, evhtp_path_t *path, void *arg)
typedef evhtp_res(* | evhtp_hook_read_cb) (evhtp_request_t *req, struct evbuffer *buf, void *arg)
typedef evhtp_res(* | evhtp_hook_request_fini_cb) (evhtp_request_t *req, void *arg)
typedef evhtp_res(* | evhtp_hook_connection_fini_cb) (evhtp_connection_t *connection, void *arg)
typedef evhtp_res(* | evhtp_hook_chunk_new_cb) (evhtp_request_t *r, uint64_t len, void *arg)
typedef evhtp_res(* | evhtp_hook_chunk_fini_cb) (evhtp_request_t *r, void *arg)
typedef evhtp_res(* | evhtp_hook_chunks_fini_cb) (evhtp_request_t *r, void *arg)
typedef evhtp_res(* | evhtp_hook_headers_start_cb) (evhtp_request_t *r, void *arg)
typedef evhtp_res(* | evhtp_hook_hostname_cb) (evhtp_request_t *r, const char *hostname, void *arg)
typedef evhtp_res(* | evhtp_hook_write_cb) (evhtp_connection_t *conn, void *arg)
typedef int(* | evhtp_kvs_iterator) (evhtp_kv_t *kv, void *arg)
typedef int(* | evhtp_headers_iterator) (evhtp_header_t *header, void *arg)
typedef int(* | evhtp_ssl_verify_cb) (int pre_verify, evhtp_x509_store_ctx_t *ctx)
typedef int(* | evhtp_ssl_chk_issued_cb) (evhtp_x509_store_ctx_t *ctx, evhtp_x509_t *x, evhtp_x509_t *issuer)
typedef EVP_PKEY *(* | evhtp_ssl_decrypt_cb) (char *privfile)
typedef int(* | evhtp_ssl_scache_add) (evhtp_connection_t *connection, evhtp_ssl_data_t *sid, int sid_len, evhtp_ssl_sess_t *sess)
typedef void(* | evhtp_ssl_scache_del) (evhtp_t *htp, evhtp_ssl_data_t *sid, int sid_len)
typedef evhtp_ssl_sess_t *(* | evhtp_ssl_scache_get) (evhtp_connection_t *connection, evhtp_ssl_data_t *sid, int sid_len)
typedef void *(* | evhtp_ssl_scache_init) (evhtp_t *)

## Enumerations

enum | evhtp_ssl_scache_type { evhtp_ssl_scache_type_disabled = 0 , evhtp_ssl_scache_type_internal , evhtp_ssl_scache_type_user , evhtp_ssl_scache_type_builtin }

enum

evhtp_hook_type {
evhtp_hook_on_header , evhtp_hook_on_headers , evhtp_hook_on_path , evhtp_hook_on_read ,
evhtp_hook_on_request_fini , evhtp_hook_on_connection_fini , evhtp_hook_on_new_chunk , evhtp_hook_on_chunk_complete ,
evhtp_hook_on_chunks_complete , evhtp_hook_on_headers_start , evhtp_hook_on_error , evhtp_hook_on_hostname ,
evhtp_hook_on_write , evhtp_hook_on_event , evhtp_hook_on_conn_error , evhtp_hook__max
}

| types associated with where a developer can hook into during the request processing cycle. More...
enum | evhtp_callback_type { evhtp_callback_type_hash , evhtp_callback_type_glob , evhtp_callback_type_regex }
enum | evhtp_proto { EVHTP_PROTO_INVALID , EVHTP_PROTO_10 , EVHTP_PROTO_11 }
enum | evhtp_type { evhtp_type_client , evhtp_type_server }

## Functions

| TAILQ_HEAD (evhtp_kvs, evhtp_kv)
EVHTP_EXPORT void | evhtp_set_mem_functions (void *(*malloc_)(size_t), void *(*realloc_)(void *, size_t), void(*free_)(void *))
EVHTP_EXPORT evhtp_t * | evhtp_new (struct event_base *evbase, void *arg)
| creates a new evhtp_t instance
EVHTP_EXPORT void | evhtp_enable_flag (evhtp_t *, int)
EVHTP_EXPORT void | evhtp_connection_enable_flag (evhtp_connection_t *, int)
EVHTP_EXPORT void | evhtp_request_enable_flag (evhtp_request_t *, int)
EVHTP_EXPORT int | evhtp_get_flags (evhtp_t *)
EVHTP_EXPORT int | evhtp_connection_get_flags (evhtp_connection_t *)
EVHTP_EXPORT int | evhtp_request_get_flags (evhtp_request_t *)
EVHTP_EXPORT void | evhtp_disable_flag (evhtp_t *, int)
EVHTP_EXPORT void | evhtp_connection_disable_flag (evhtp_connection_t *, int)
EVHTP_EXPORT void | evhtp_request_disable_flag (evhtp_request_t *, int)
EVHTP_EXPORT void | evhtp_free (evhtp_t *evhtp)
| Frees evhtp_t structure; will stop and free threads associated with the structure, and free the ssl context as well (if applicable).
EVHTP_EXPORT void | evhtp_set_timeouts (evhtp_t *htp, const struct timeval *r, const struct timeval *w)
| set a read/write timeout on all things evhtp_t.
EVHTP_EXPORT void | evhtp_set_parser_flags (evhtp_t *htp, int flags)
| during the request processing cycle, these flags will be used to for query argument parsing.
EVHTP_EXPORT void | evhtp_set_bev_flags (evhtp_t *htp, int flags)
| bufferevent flags which will be used for bev sockets.
EVHTP_EXPORT int | evhtp_ssl_use_threads (void)
EVHTP_EXPORT int | evhtp_ssl_init (evhtp_t *htp, evhtp_ssl_cfg_t *ssl_cfg)
EVHTP_EXPORT void | evhtp_disable_100_continue (evhtp_t *htp) DEPRECATED("evhtp_disable_100 will soon be deprecated
| when a client sends an Expect: 100-continue, if this is function is called, evhtp will not send a HTTP/x.x continue response.
EVHTP_EXPORT int | evhtp_use_callback_locks (evhtp_t *htp)
| creates a lock around callbacks and hooks, allowing for threaded applications to add/remove/modify hooks & callbacks in a thread-safe manner.
EVHTP_EXPORT void | evhtp_set_gencb (evhtp_t *htp, evhtp_callback_cb cb, void *arg)
| sets a callback which is called if no other callbacks are matched
EVHTP_EXPORT void | evhtp_set_pre_accept_cb (evhtp_t *htp, evhtp_pre_accept_cb, void *arg)
| call a user-defined function before the connection is accepted.
EVHTP_EXPORT void | evhtp_set_post_accept_cb (evhtp_t *htp, evhtp_post_accept_cb, void *arg)
| call a user-defined function right after a connection is accepted.
EVHTP_EXPORT evhtp_callback_t * | evhtp_set_cb (evhtp_t *htp, const char *path, evhtp_callback_cb cb, void *arg)
| sets a callback to be executed on a specific path
EVHTP_EXPORT evhtp_callback_t * | evhtp_set_regex_cb (evhtp_t *htp, const char *pattern, evhtp_callback_cb cb, void *arg)
| sets a callback to be executed based on a regex pattern
EVHTP_EXPORT evhtp_callback_t * | evhtp_set_glob_cb (evhtp_t *htp, const char *pattern, evhtp_callback_cb cb, void *arg)
| sets a callback to to be executed on simple glob/wildcard patterns this is useful if the app does not care about what was matched, but just that it matched.
EVHTP_EXPORT evhtp_callback_t * | evhtp_get_cb (evhtp_t *htp, const char *needle)
| attempts to find the callback matching the exact string 'needle'.
EVHTP_EXPORT int | evhtp_connection_set_hook (evhtp_connection_t *c, evhtp_hook_type type, evhtp_hook cb, void *arg)
| sets a callback hook for either a connection or a path/regex .
EVHTP_EXPORT int | evhtp_request_set_hook (evhtp_request_t *r, evhtp_hook_type type, evhtp_hook cb, void *arg)
EVHTP_EXPORT int | evhtp_callback_set_hook (evhtp_callback_t *cb, evhtp_hook_type type, evhtp_hook hookcb, void *arg)
EVHTP_EXPORT evhtp_hooks_t * | evhtp_connection_get_hooks (evhtp_connection_t *c)
EVHTP_EXPORT evhtp_hooks_t * | evhtp_request_get_hooks (evhtp_request_t *r)
| returns request hooks
EVHTP_EXPORT evhtp_hooks_t * | evhtp_callback_get_hooks (evhtp_callback_t *cb)
| returns callback hooks
EVHTP_EXPORT int | evhtp_unset_all_hooks (evhtp_hooks_t **hooks)
| removes all hooks.
EVHTP_EXPORT int | evhtp_request_unset_hook (evhtp_request_t *req, evhtp_hook_type type)
EVHTP_EXPORT int | evhtp_connection_unset_hook (evhtp_connection_t *conn, evhtp_hook_type type)
EVHTP_EXPORT int | evhtp_callback_unset_hook (evhtp_callback_t *callback, evhtp_hook_type type)
EVHTP_EXPORT int | evhtp_bind_socket (evhtp_t *htp, const char *addr, uint16_t port, int backlog)
| bind to a socket, optionally with specific protocol support formatting.
EVHTP_EXPORT void | evhtp_unbind_socket (evhtp_t *htp)
| stops the listening socket.
EVHTP_EXPORT int | evhtp_accept_socket (evhtp_t *htp, evutil_socket_t sock, int backlog)
| create the listener plus setup various options with an already-bound socket.
EVHTP_EXPORT int | evhtp_bind_sockaddr (evhtp_t *htp, struct sockaddr *, size_t sin_len, int backlog)
| bind to an already allocated sockaddr.
EVHTP_EXPORT int | evhtp_use_threads (evhtp_t *, evhtp_thread_init_cb, int nthreads, void *) DEPRECATED("will take on the syntax of evhtp_use_threads_wexit")
| Enable thread-pool support for an evhtp_t context.
EVHTP_EXPORT int | evhtp_use_threads_wexit (evhtp_t *, evhtp_thread_init_cb, evhtp_thread_exit_cb, int nthreads, void *arg)
| Temporary function which will be renamed evhtp_use_threads in the future.
EVHTP_EXPORT void | evhtp_send_reply (evhtp_request_t *request, evhtp_res code)
| generates all the right information for a reply to be sent to the client
EVHTP_EXPORT void | evhtp_send_reply_start (evhtp_request_t *request, evhtp_res code)
EVHTP_EXPORT void | evhtp_send_reply_body (evhtp_request_t *request, struct evbuffer *buf)
EVHTP_EXPORT void | evhtp_send_reply_end (evhtp_request_t *request)
EVHTP_EXPORT int | evhtp_response_needs_body (const evhtp_res code, const htp_method method)
| Determine if a response should have a body.
EVHTP_EXPORT void | evhtp_send_reply_chunk_start (evhtp_request_t *request, evhtp_res code)
| start a chunked response.
EVHTP_EXPORT void | evhtp_send_reply_chunk (evhtp_request_t *request, struct evbuffer *buf)
| send a chunk reply.
EVHTP_EXPORT void | evhtp_send_reply_chunk_end (evhtp_request_t *request)
| call when all chunks have been sent and you wish to send the last bits.
EVHTP_EXPORT evhtp_callback_t * | evhtp_callback_new (const char *path, evhtp_callback_type type, evhtp_callback_cb cb, void *arg)
| creates a new evhtp_callback_t structure.
EVHTP_EXPORT void | evhtp_callback_free (evhtp_callback_t *callback)
| safely frees callback structure memory and internals
EVHTP_EXPORT int | evhtp_callbacks_add_callback (evhtp_callbacks_t *cbs, evhtp_callback_t *cb)
| Adds a evhtp_callback_t to the evhtp_callbacks_t list.
EVHTP_EXPORT int | evhtp_add_vhost (evhtp_t *evhtp, const char *name, evhtp_t *vhost)
| add an evhtp_t structure (with its own callbacks) to a base evhtp_t structure for virtual hosts.
EVHTP_EXPORT int | evhtp_add_alias (evhtp_t *evhtp, const char *name)
| Add an alias hostname for a virtual-host specific evhtp_t.
EVHTP_EXPORT int | evhtp_add_aliases (evhtp_t *evhtp, const char *name,...)
| set a variable number of aliases in one call @reference evhtp_add_alias
EVHTP_EXPORT evhtp_kv_t * | evhtp_kv_new (const char *key, const char *val, char kalloc, char valloc)
| Allocates a new key/value structure.
EVHTP_EXPORT evhtp_kvs_t * | evhtp_kvs_new (void)
| creates an empty list of key/values
EVHTP_EXPORT void | evhtp_kv_free (evhtp_kv_t *kv)
| frees resources allocated for a single key/value
EVHTP_EXPORT void | evhtp_kvs_free (evhtp_kvs_t *kvs)
| frees a the list of key/values, and all underlying entries
EVHTP_EXPORT void | evhtp_kv_rm_and_free (evhtp_kvs_t *kvs, evhtp_kv_t *kv)
| free's resources associated with 'kv' if ONLY found within the key/value list
EVHTP_EXPORT const char * | evhtp_kv_find (evhtp_kvs_t *kvs, const char *key)
| find the string value of 'key' from the key/value list 'kvs'
EVHTP_EXPORT evhtp_kv_t * | evhtp_kvs_find_kv (evhtp_kvs_t *kvs, const char *key)
| find the evhtp_kv_t reference 'key' from the k/val list 'kvs'
EVHTP_EXPORT void | evhtp_kvs_add_kv (evhtp_kvs_t *kvs, evhtp_kv_t *kv)
| appends a key/val structure to a evhtp_kvs_t tailq
EVHTP_EXPORT void | evhtp_kvs_add_kvs (evhtp_kvs_t *dst, evhtp_kvs_t *src)
| appends all key/val structures from src tailq onto dst tailq
EVHTP_EXPORT int | evhtp_kvs_for_each (evhtp_kvs_t *kvs, evhtp_kvs_iterator cb, void *arg)
| callback iterator which executes 'cb' for every entry in 'kvs'
EVHTP_EXPORT evhtp_query_t * | evhtp_parse_query_wflags (const char *query, size_t len, int flags)
| Parses the query portion of the uri into a set of key/values.
EVHTP_EXPORT evhtp_query_t * | evhtp_parse_query (const char *query, size_t len)
| Parses the query portion of the uri into a set of key/values in a strict manner.
EVHTP_EXPORT int | evhtp_unescape_string (unsigned char **out, unsigned char *str, size_t str_len)
| Unescapes strings like '%7B1,%202,%203%7D' would become '{1, 2, 3}'.
EVHTP_EXPORT evhtp_header_t * | evhtp_header_new (const char *key, const char *val, char kalloc, char valloc)
| creates a new evhtp_header_t key/val structure
EVHTP_EXPORT evhtp_header_t * | evhtp_header_key_add (evhtp_headers_t *headers, const char *key, char kalloc)
| creates a new evhtp_header_t, sets only the key, and adds to the evhtp_headers TAILQ
EVHTP_EXPORT evhtp_header_t * | evhtp_header_val_add (evhtp_headers_t *headers, const char *val, char valloc)
| finds the last header in the headers tailq and adds the value
EVHTP_EXPORT void | evhtp_headers_add_header (evhtp_headers_t *headers, evhtp_header_t *header)
| adds an evhtp_header_t to the end of the evhtp_headers_t tailq
EVHTP_EXPORT const char * | evhtp_header_find (evhtp_headers_t *headers, const char *key)
| finds the value of a key in a evhtp_headers_t structure
EVHTP_EXPORT htp_method | evhtp_request_get_method (evhtp_request_t *r)
| returns the htp_method enum version of the request method.
EVHTP_EXPORT evhtp_proto | evhtp_request_get_proto (evhtp_request_t *r)
EVHTP_EXPORT evhtp_res | evhtp_request_get_status_code (evhtp_request_t *r)
| Returns the last status code set for a request (request/response).
EVHTP_EXPORT const char * | evhtp_request_get_status_code_str (evhtp_request_t *r)
| wrapper around get_status_code that returns the string version of the last status code set for a request.
EVHTP_EXPORT void | evhtp_connection_pause (evhtp_connection_t *connection)
| pauses a connection (disables reading)
EVHTP_EXPORT void | evhtp_connection_resume (evhtp_connection_t *connection)
| resumes a connection (enables reading) and activates resume event.
EVHTP_EXPORT void | evhtp_request_pause (evhtp_request_t *request)
| Wrapper around evhtp_connection_pause.
EVHTP_EXPORT void | evhtp_request_resume (evhtp_request_t *request)
| Wrapper around evhtp_connection_resume.
EVHTP_EXPORT evhtp_connection_t * | evhtp_request_get_connection (evhtp_request_t *request)
| returns the underlying evhtp_connection_t structure from a request
EVHTP_EXPORT void | evhtp_connection_set_bev (evhtp_connection_t *conn, struct bufferevent *bev)
| Sets the connections underlying bufferevent.
EVHTP_EXPORT void | evhtp_request_set_bev (evhtp_request_t *request, struct bufferevent *bev)
| sets the underlying bufferevent for a evhtp_request
EVHTP_EXPORT struct bufferevent * | evhtp_connection_get_bev (evhtp_connection_t *conn)
| returns the underlying connections bufferevent
EVHTP_EXPORT void | evhtp_connection_set_timeouts (evhtp_connection_t *conn, const struct timeval *r, const struct timeval *w)
| sets a connection-specific read/write timeout which overrides the global read/write settings.
EVHTP_EXPORT struct bufferevent * | evhtp_request_get_bev (evhtp_request_t *request)
| returns the underlying requests bufferevent
EVHTP_EXPORT struct bufferevent * | evhtp_connection_take_ownership (evhtp_connection_t *connection)
| let a user take ownership of the underlying bufferevent and free all other underlying resources.
EVHTP_EXPORT void | evhtp_connection_free (evhtp_connection_t *connection)
| free's all connection related resources, this will also call your request fini hook and request fini hook.
EVHTP_EXPORT void | evhtp_request_free (evhtp_request_t *request)
EVHTP_EXPORT void | evhtp_set_max_body_size (evhtp_t *htp, uint64_t len)
| set a max body size to accept for an incoming request, this will default to unlimited.
EVHTP_EXPORT void | evhtp_connection_set_max_body_size (evhtp_connection_t *conn, uint64_t len)
| set a max body size for a specific connection, this will default to the size set by evhtp_set_max_body_size
EVHTP_EXPORT void | evhtp_request_set_max_body_size (evhtp_request_t *request, uint64_t len)
| just calls evhtp_connection_set_max_body_size for the request.
EVHTP_EXPORT void | evhtp_request_set_keepalive (evhtp_request_t *request, int val)
EVHTP_EXPORT void | evhtp_set_max_keepalive_requests (evhtp_t *htp, uint64_t num)
| sets a maximum number of requests that a single connection can make.
EVHTP_EXPORT evhtp_connection_t * | evhtp_connection_new_dns (struct event_base *evbase, struct evdns_base *dns_base, const char *addr, uint16_t port)
| allocate a new connection
EVHTP_EXPORT evhtp_connection_t * | evhtp_connection_new (struct event_base *evbase, const char *addr, uint16_t port)
| allocate a new connection
EVHTP_EXPORT evhtp_connection_t * | evhtp_connection_ssl_new (struct event_base *evbase, const char *addr, uint16_t port, evhtp_ssl_ctx_t *ctx)
EVHTP_EXPORT evhtp_request_t * | evhtp_request_new (evhtp_callback_cb cb, void *arg)
| allocate a new request
EVHTP_EXPORT int | evhtp_make_request (evhtp_connection_t *c, evhtp_request_t *r, htp_method meth, const char *uri)
| make a client request
EVHTP_EXPORT unsigned int | evhtp_request_status (evhtp_request_t *)

## Variables

EVHTP_EXPORT void use htp flags | instead

## Macro Definition Documentation

## EVHTP_CONN_FLAG_CONNECTED

#define EVHTP_CONN_FLAG_CONNECTED (1 << 5)

client specific - set after successful connection

Definition at line 453 of file evhtp/evhtp.h.

## EVHTP_CONN_FLAG_ERROR

#define EVHTP_CONN_FLAG_ERROR (1 << 1)

Definition at line 449 of file evhtp/evhtp.h.

## EVHTP_CONN_FLAG_FREE_CONN

#define EVHTP_CONN_FLAG_FREE_CONN (1 << 7)

Definition at line 455 of file evhtp/evhtp.h.

## EVHTP_CONN_FLAG_KEEPALIVE

#define EVHTP_CONN_FLAG_KEEPALIVE (1 << 8)

set to 1 after the first request has been processed and the connection is kept open

Definition at line 456 of file evhtp/evhtp.h.

## EVHTP_CONN_FLAG_OWNER

#define EVHTP_CONN_FLAG_OWNER (1 << 2)

set to 1 if this structure owns the bufferevent

Definition at line 450 of file evhtp/evhtp.h.

## EVHTP_CONN_FLAG_PAUSED

#define EVHTP_CONN_FLAG_PAUSED (1 << 4)

this connection has been marked as paused

Definition at line 452 of file evhtp/evhtp.h.

## EVHTP_CONN_FLAG_VHOST_VIA_SNI

#define EVHTP_CONN_FLAG_VHOST_VIA_SNI (1 << 3)

set to 1 if the vhost was found via SSL SNI

Definition at line 451 of file evhtp/evhtp.h.

## EVHTP_CONN_FLAG_WAITING

#define EVHTP_CONN_FLAG_WAITING (1 << 6)

used to make sure resuming happens AFTER sending a reply

Definition at line 454 of file evhtp/evhtp.h.

## EVHTP_FLAG_DEFAULTS

#define EVHTP_FLAG_DEFAULTS EVHTP_FLAG_ENABLE_100_CONT

Definition at line 297 of file evhtp/evhtp.h.

## EVHTP_FLAG_ENABLE_100_CONT

#define EVHTP_FLAG_ENABLE_100_CONT (1 << 1)

Definition at line 293 of file evhtp/evhtp.h.

## EVHTP_FLAG_ENABLE_ALL

#define EVHTP_FLAG_ENABLE_ALL

Value:
EVHTP_FLAG_ENABLE_100_CONT \
| EVHTP_FLAG_ENABLE_REUSEPORT \
| EVHTP_FLAG_ENABLE_NODELAY \
| EVHTP_FLAG_ENABLE_DEFER_ACCEPT
EVHTP_FLAG_ENABLE_100_CONT
#define EVHTP_FLAG_ENABLE_100_CONT
Definition evhtp/evhtp.h:293
EVHTP_FLAG_ENABLE_NODELAY
#define EVHTP_FLAG_ENABLE_NODELAY
Definition evhtp/evhtp.h:295
EVHTP_FLAG_ENABLE_REUSEPORT
#define EVHTP_FLAG_ENABLE_REUSEPORT
Definition evhtp/evhtp.h:294
EVHTP_FLAG_ENABLE_DEFER_ACCEPT
#define EVHTP_FLAG_ENABLE_DEFER_ACCEPT
Definition evhtp/evhtp.h:296

Definition at line 298 of file evhtp/evhtp.h.

## EVHTP_FLAG_ENABLE_DEFER_ACCEPT

#define EVHTP_FLAG_ENABLE_DEFER_ACCEPT (1 << 4)

Definition at line 296 of file evhtp/evhtp.h.

## EVHTP_FLAG_ENABLE_NODELAY

#define EVHTP_FLAG_ENABLE_NODELAY (1 << 3)

Definition at line 295 of file evhtp/evhtp.h.

## EVHTP_FLAG_ENABLE_REUSEPORT

#define EVHTP_FLAG_ENABLE_REUSEPORT (1 << 2)

Definition at line 294 of file evhtp/evhtp.h.

## evhtp_header_free

#define evhtp_header_free evhtp_kv_free

Definition at line 1214 of file evhtp/evhtp.h.

## evhtp_header_rm_and_free

#define evhtp_header_rm_and_free evhtp_kv_rm_and_free

Definition at line 1217 of file evhtp/evhtp.h.

## evhtp_headers_add_headers

#define evhtp_headers_add_headers evhtp_kvs_add_kvs

Definition at line 1218 of file evhtp/evhtp.h.

## evhtp_headers_find_header

#define evhtp_headers_find_header evhtp_kvs_find_kv

Definition at line 1212 of file evhtp/evhtp.h.

## evhtp_headers_for_each

#define evhtp_headers_for_each evhtp_kvs_for_each

Definition at line 1213 of file evhtp/evhtp.h.

## evhtp_headers_free

#define evhtp_headers_free evhtp_kvs_free

Definition at line 1216 of file evhtp/evhtp.h.

## evhtp_headers_iterator

#define evhtp_headers_iterator evhtp_kvs_iterator

Definition at line 197 of file evhtp/evhtp.h.

## evhtp_headers_new

#define evhtp_headers_new evhtp_kvs_new

Definition at line 1215 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS

#define EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS (1 << 1)

Definition at line 1105 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS

#define EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS (1 << 2)

Definition at line 1106 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_DEFAULT

#define EVHTP_PARSE_QUERY_FLAG_DEFAULT EVHTP_PARSE_QUERY_FLAG_LENIENT

Definition at line 1115 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_IGNORE_FRAGMENTS

#define EVHTP_PARSE_QUERY_FLAG_IGNORE_FRAGMENTS (1 << 4)

Definition at line 1108 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX

#define EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX (1 << 0)

Definition at line 1104 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_LENIENT

#define EVHTP_PARSE_QUERY_FLAG_LENIENT

Value:
EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX \
| EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS \
| EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS \
| EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP
EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP
#define EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP
Definition evhtp/evhtp.h:1107
EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS
#define EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS
Definition evhtp/evhtp.h:1105
EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX
#define EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX
Definition evhtp/evhtp.h:1104
EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS
#define EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS
Definition evhtp/evhtp.h:1106

Definition at line 1109 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_STRICT

#define EVHTP_PARSE_QUERY_FLAG_STRICT 0

Definition at line 1103 of file evhtp/evhtp.h.

## EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP

#define EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP (1 << 3)

Definition at line 1107 of file evhtp/evhtp.h.

## evhtp_query_free

#define evhtp_query_free evhtp_kvs_free

Definition at line 1220 of file evhtp/evhtp.h.

## evhtp_query_new

#define evhtp_query_new evhtp_kvs_new

Definition at line 1219 of file evhtp/evhtp.h.

## EVHTP_REQ_FLAG_CHUNKED

#define EVHTP_REQ_FLAG_CHUNKED (1 << 3)

Definition at line 415 of file evhtp/evhtp.h.

## EVHTP_REQ_FLAG_ERROR

#define EVHTP_REQ_FLAG_ERROR (1 << 4)

Definition at line 416 of file evhtp/evhtp.h.

## EVHTP_REQ_FLAG_FINISHED

#define EVHTP_REQ_FLAG_FINISHED (1 << 2)

Definition at line 414 of file evhtp/evhtp.h.

## EVHTP_REQ_FLAG_KEEPALIVE

#define EVHTP_REQ_FLAG_KEEPALIVE (1 << 1)

Definition at line 413 of file evhtp/evhtp.h.

## evhtp_request_content_len

#define evhtp_request_content_len | ( |  | r | ) |

Value:
htparser_get_content_length(r->conn->parser)
htparser_get_content_length
uint64_t htparser_get_content_length(htparser *p)
Definition parser.c:551

Definition at line 425 of file evhtp/evhtp.h.

## EVHTP_RES_DATA_TOO_LONG

#define EVHTP_RES_DATA_TOO_LONG 4

Definition at line 203 of file evhtp/evhtp.h.

## EVHTP_RES_ERROR

#define EVHTP_RES_ERROR 0

Definition at line 199 of file evhtp/evhtp.h.

## EVHTP_RES_FATAL

#define EVHTP_RES_FATAL 2

Definition at line 201 of file evhtp/evhtp.h.

## EVHTP_RES_OK

#define EVHTP_RES_OK 200

Definition at line 204 of file evhtp/evhtp.h.

## EVHTP_RES_PAUSE

#define EVHTP_RES_PAUSE 1

Definition at line 200 of file evhtp/evhtp.h.

## EVHTP_RES_USER

#define EVHTP_RES_USER 3

Definition at line 202 of file evhtp/evhtp.h.

## evhtp_safe_free

#define evhtp_safe_free | ( |  | _var,
|  |  | _freefn )

Value:
do { \
_freefn((_var)); \
(_var) = NULL; \
} while (0)

Definition at line 1445 of file evhtp/evhtp.h.

## EVHTP_VERSION

#define EVHTP_VERSION "1.2.18"

Definition at line 192 of file evhtp/evhtp.h.

## EVHTP_VERSION_MAJOR

#define EVHTP_VERSION_MAJOR 1

Definition at line 193 of file evhtp/evhtp.h.

## EVHTP_VERSION_MINOR

#define EVHTP_VERSION_MINOR 2

Definition at line 194 of file evhtp/evhtp.h.

## EVHTP_VERSION_PATCH

#define EVHTP_VERSION_PATCH 18

Definition at line 195 of file evhtp/evhtp.h.

## thread_init_cbarg

#define thread_init_cbarg thread_cbarg

Definition at line 321 of file evhtp/evhtp.h.

## Typedef Documentation

## evbev_t

typedef struct bufferevent evbev_t

Definition at line 65 of file evhtp/evhtp.h.

## evbuf_t

typedef struct evbuffer evbuf_t

Definition at line 62 of file evhtp/evhtp.h.

## event_t

typedef struct event event_t

Definition at line 63 of file evhtp/evhtp.h.

## evhtp_callback_cb

typedef void(* evhtp_callback_cb) (evhtp_request_t *req, void *arg)

Definition at line 154 of file evhtp/evhtp.h.

## evhtp_callback_type

typedef enum evhtp_callback_type evhtp_callback_type

Definition at line 147 of file evhtp/evhtp.h.

## evhtp_callbacks_t

typedef struct evhtp_callbacks evhtp_callbacks_t

Definition at line 78 of file evhtp/evhtp.h.

## evhtp_error_flags

typedef uint8_t evhtp_error_flags

Definition at line 91 of file evhtp/evhtp.h.

## evhtp_headers_iterator

typedef int(* evhtp_headers_iterator) (evhtp_header_t *header, void *arg)

Definition at line 178 of file evhtp/evhtp.h.

## evhtp_headers_t

typedef struct evhtp_kvs evhtp_headers_t

Definition at line 94 of file evhtp/evhtp.h.

## evhtp_hook

typedef evhtp_res(* evhtp_hook) ()

Definition at line 159 of file evhtp/evhtp.h.

## evhtp_hook_chunk_fini_cb

typedef evhtp_res(* evhtp_hook_chunk_fini_cb) (evhtp_request_t *r, void *arg)

Definition at line 171 of file evhtp/evhtp.h.

## evhtp_hook_chunk_new_cb

typedef evhtp_res(* evhtp_hook_chunk_new_cb) (evhtp_request_t *r, uint64_t len, void *arg)

Definition at line 170 of file evhtp/evhtp.h.

## evhtp_hook_chunks_fini_cb

typedef evhtp_res(* evhtp_hook_chunks_fini_cb) (evhtp_request_t *r, void *arg)

Definition at line 172 of file evhtp/evhtp.h.

## evhtp_hook_conn_err_cb

typedef evhtp_res(* evhtp_hook_conn_err_cb) (evhtp_connection_t *connection, evhtp_error_flags errtype, void *arg)

Definition at line 161 of file evhtp/evhtp.h.

## evhtp_hook_connection_fini_cb

typedef evhtp_res(* evhtp_hook_connection_fini_cb) (evhtp_connection_t *connection, void *arg)

Definition at line 169 of file evhtp/evhtp.h.

## evhtp_hook_err_cb

typedef void(* evhtp_hook_err_cb) (evhtp_request_t *req, evhtp_error_flags errtype, void *arg)

Definition at line 155 of file evhtp/evhtp.h.

## evhtp_hook_event_cb

typedef void(* evhtp_hook_event_cb) (evhtp_connection_t *conn, short events, void *arg)

Definition at line 156 of file evhtp/evhtp.h.

## evhtp_hook_header_cb

typedef evhtp_res(* evhtp_hook_header_cb) (evhtp_request_t *req, evhtp_header_t *hdr, void *arg)

Definition at line 164 of file evhtp/evhtp.h.

## evhtp_hook_headers_cb

typedef evhtp_res(* evhtp_hook_headers_cb) (evhtp_request_t *req, evhtp_headers_t *hdr, void *arg)

Definition at line 165 of file evhtp/evhtp.h.

## evhtp_hook_headers_start_cb

typedef evhtp_res(* evhtp_hook_headers_start_cb) (evhtp_request_t *r, void *arg)

Definition at line 173 of file evhtp/evhtp.h.

## evhtp_hook_hostname_cb

typedef evhtp_res(* evhtp_hook_hostname_cb) (evhtp_request_t *r, const char *hostname, void *arg)

Definition at line 174 of file evhtp/evhtp.h.

## evhtp_hook_path_cb

typedef evhtp_res(* evhtp_hook_path_cb) (evhtp_request_t *req, evhtp_path_t *path, void *arg)

Definition at line 166 of file evhtp/evhtp.h.

## evhtp_hook_read_cb

typedef evhtp_res(* evhtp_hook_read_cb) (evhtp_request_t *req, struct evbuffer *buf, void *arg)

Definition at line 167 of file evhtp/evhtp.h.

## evhtp_hook_request_fini_cb

typedef evhtp_res(* evhtp_hook_request_fini_cb) (evhtp_request_t *req, void *arg)

Definition at line 168 of file evhtp/evhtp.h.

## evhtp_hook_type

typedef enum evhtp_hook_type evhtp_hook_type

Definition at line 146 of file evhtp/evhtp.h.

## evhtp_hook_write_cb

typedef evhtp_res(* evhtp_hook_write_cb) (evhtp_connection_t *conn, void *arg)

Definition at line 175 of file evhtp/evhtp.h.

## evhtp_kvs_iterator

typedef int(* evhtp_kvs_iterator) (evhtp_kv_t *kv, void *arg)

Definition at line 177 of file evhtp/evhtp.h.

## evhtp_kvs_t

typedef struct evhtp_kvs evhtp_kvs_t

Definition at line 81 of file evhtp/evhtp.h.

## evhtp_mutex_t

typedef pthread_mutex_t evhtp_mutex_t

Definition at line 73 of file evhtp/evhtp.h.

## evhtp_post_accept_cb

typedef evhtp_res(* evhtp_post_accept_cb) (evhtp_connection_t *conn, void *arg)

Definition at line 163 of file evhtp/evhtp.h.

## evhtp_pre_accept_cb

typedef evhtp_res(* evhtp_pre_accept_cb) (evhtp_connection_t *conn, void *arg)

Definition at line 162 of file evhtp/evhtp.h.

## evhtp_proto

typedef enum evhtp_proto evhtp_proto

Definition at line 148 of file evhtp/evhtp.h.

## evhtp_query_t

typedef struct evhtp_kvs evhtp_query_t

Definition at line 95 of file evhtp/evhtp.h.

## evhtp_res

typedef uint16_t evhtp_res

Definition at line 90 of file evhtp/evhtp.h.

## evhtp_ssl_chk_issued_cb

typedef int(* evhtp_ssl_chk_issued_cb) (evhtp_x509_store_ctx_t *ctx, evhtp_x509_t *x, evhtp_x509_t *issuer)

Definition at line 182 of file evhtp/evhtp.h.

## evhtp_ssl_ctx_t

typedef SSL_CTX evhtp_ssl_ctx_t

Definition at line 46 of file evhtp/evhtp.h.

## evhtp_ssl_data_t

typedef unsigned char evhtp_ssl_data_t

Definition at line 50 of file evhtp/evhtp.h.

## evhtp_ssl_decrypt_cb

typedef EVP_PKEY *(* evhtp_ssl_decrypt_cb) (char *privfile)

Definition at line 183 of file evhtp/evhtp.h.

## evhtp_ssl_scache_add

typedef int(* evhtp_ssl_scache_add) (evhtp_connection_t *connection, evhtp_ssl_data_t *sid, int sid_len, evhtp_ssl_sess_t *sess)

Definition at line 185 of file evhtp/evhtp.h.

## evhtp_ssl_scache_del

typedef void(* evhtp_ssl_scache_del) (evhtp_t *htp, evhtp_ssl_data_t *sid, int sid_len)

Definition at line 186 of file evhtp/evhtp.h.

## evhtp_ssl_scache_get

typedef evhtp_ssl_sess_t *(* evhtp_ssl_scache_get) (evhtp_connection_t *connection, evhtp_ssl_data_t *sid, int sid_len)

Definition at line 187 of file evhtp/evhtp.h.

## evhtp_ssl_scache_init

typedef void *(* evhtp_ssl_scache_init) (evhtp_t *)

Definition at line 189 of file evhtp/evhtp.h.

## evhtp_ssl_scache_type

typedef enum evhtp_ssl_scache_type evhtp_ssl_scache_type

Definition at line 149 of file evhtp/evhtp.h.

## evhtp_ssl_sess_t

typedef SSL_SESSION evhtp_ssl_sess_t

Definition at line 44 of file evhtp/evhtp.h.

## evhtp_ssl_t

typedef SSL evhtp_ssl_t

Definition at line 45 of file evhtp/evhtp.h.

## evhtp_ssl_verify_cb

typedef int(* evhtp_ssl_verify_cb) (int pre_verify, evhtp_x509_store_ctx_t *ctx)

Definition at line 181 of file evhtp/evhtp.h.

## evhtp_thread_exit_cb

typedef void(* evhtp_thread_exit_cb) (evhtp_t *htp, evthr_t *thr, void *arg)

Definition at line 153 of file evhtp/evhtp.h.

## evhtp_thread_init_cb

typedef void(* evhtp_thread_init_cb) (evhtp_t *htp, evthr_t *thr, void *arg)

Definition at line 152 of file evhtp/evhtp.h.

## evhtp_type

typedef enum evhtp_type evhtp_type

Definition at line 150 of file evhtp/evhtp.h.

## evhtp_x509_store_ctx_t

typedef X509_STORE_CTX evhtp_x509_store_ctx_t

Definition at line 48 of file evhtp/evhtp.h.

## evhtp_x509_t

typedef X509 evhtp_x509_t

Definition at line 47 of file evhtp/evhtp.h.

## evserv_t

typedef struct evconnlistener evserv_t

Definition at line 64 of file evhtp/evhtp.h.

## Enumeration Type Documentation

## evhtp_callback_type

enum evhtp_callback_type

Enumerator
evhtp_callback_type_hash |
evhtp_callback_type_glob |
evhtp_callback_type_regex |

Definition at line 127 of file evhtp/evhtp.h.

## evhtp_hook_type

enum evhtp_hook_type

types associated with where a developer can hook into during the request processing cycle.

Enumerator
evhtp_hook_on_header | type which defines to hook after one header has been parsed
evhtp_hook_on_headers | type which defines to hook after all headers have been parsed
evhtp_hook_on_path | type which defines to hook once a path has been parsed
evhtp_hook_on_read | type which defines to hook whenever the parser recieves data in a body
evhtp_hook_on_request_fini | type which defines to hook before the request is free'd
evhtp_hook_on_connection_fini |
evhtp_hook_on_new_chunk |
evhtp_hook_on_chunk_complete |
evhtp_hook_on_chunks_complete |
evhtp_hook_on_headers_start |
evhtp_hook_on_error | type which defines to hook whenever an error occurs
evhtp_hook_on_hostname |
evhtp_hook_on_write |
evhtp_hook_on_event |
evhtp_hook_on_conn_error | type which defines to hook whenever a connection error occurs
evhtp_hook__max |

Definition at line 108 of file evhtp/evhtp.h.

## evhtp_proto

enum evhtp_proto

Enumerator
EVHTP_PROTO_INVALID |
EVHTP_PROTO_10 |
EVHTP_PROTO_11 |

Definition at line 135 of file evhtp/evhtp.h.

## evhtp_ssl_scache_type

enum evhtp_ssl_scache_type

Enumerator
evhtp_ssl_scache_type_disabled |
evhtp_ssl_scache_type_internal |
evhtp_ssl_scache_type_user |
evhtp_ssl_scache_type_builtin |

Definition at line 97 of file evhtp/evhtp.h.

## evhtp_type

enum evhtp_type

Enumerator
evhtp_type_client |
evhtp_type_server |

Definition at line 141 of file evhtp/evhtp.h.

## Function Documentation

## evhtp_accept_socket()

EVHTP_EXPORT int evhtp_accept_socket | ( | evhtp_t * | htp,
|  | evutil_socket_t | sock,
|  | int | backlog )

create the listener plus setup various options with an already-bound socket.

Note
  Since the file descriptor is passed to the function, it will not attempt to close it if an error occurs.

Parameters

  htp |
  sock |
  backlog |

Returns
  0 on success, -1 on error (check errno)

Definition at line 3997 of file evhtp.c.

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

## evhtp_add_alias()

EVHTP_EXPORT int evhtp_add_alias | ( | evhtp_t * | evhtp,
|  | const char * | name )

Add an alias hostname for a virtual-host specific evhtp_t.

This avoids having multiple evhtp_t virtual hosts with the same callback for the same vhost.

Parameters

  evhtp |
  name |

Returns

Definition at line 5177 of file evhtp.c.

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

## evhtp_add_aliases()

EVHTP_EXPORT int evhtp_add_aliases | ( | evhtp_t * | evhtp,
|  | const char * | name,
|  |  | ... )

set a variable number of aliases in one call @reference evhtp_add_alias

Note
  last argument must be NULL terminated

Parameters

  evhtp |
  name |
  ... |

Returns
  0 on success, -1 on error

Definition at line 5205 of file evhtp.c.

Here is the call graph for this function:

## evhtp_add_vhost()

EVHTP_EXPORT int evhtp_add_vhost | ( | evhtp_t * | evhtp,
|  | const char * | name,
|  | evhtp_t * | vhost )

add an evhtp_t structure (with its own callbacks) to a base evhtp_t structure for virtual hosts.

It should be noted that if you enable SSL on the base evhtp_t and your version of OpenSSL supports SNI, the SNI hostname will always take precedence over the Host header value.

Parameters

  evhtp |
  name |
  vhost |

Returns

Definition at line 5232 of file evhtp.c.

Here is the call graph for this function:

## evhtp_bind_sockaddr()

EVHTP_EXPORT int evhtp_bind_sockaddr | ( | evhtp_t * | htp,
|  | struct sockaddr * | sa,
|  | size_t | sin_len,
|  | int | backlog )

bind to an already allocated sockaddr.

See also
  evhtp_bind_socket

Parameters

  htp | - ptr to evhtp_t structure
  sa | - ptr to sockaddr structure
  sin_len | - size of sockaddr structure
  backlog | - backlog flag

Returns
  0 on success, -1 on fail

Definition at line 4047 of file evhtp.c.

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

## evhtp_bind_socket()

EVHTP_EXPORT int evhtp_bind_socket | ( | evhtp_t * | htp,
|  | const char * | addr,
|  | uint16_t | port,
|  | int | backlog )

bind to a socket, optionally with specific protocol support formatting.

The addr can be defined as one of the following: ipv6:<ipv6addr> for binding to an IPv6 address. unix:<named pipe> for binding to a unix named socket ipv4:<ipv4addr> for binding to an ipv4 address Otherwise the addr is assumed to be ipv4.

Parameters

  htp |
  addr |
  port |
  backlog |

Returns

Definition at line 4114 of file evhtp.c.

Here is the call graph for this function:

## evhtp_callback_free()

EVHTP_EXPORT void evhtp_callback_free | ( | evhtp_callback_t * | callback | ) |

safely frees callback structure memory and internals

See also
  evhtp_safe_free

Parameters

  callback | - callback to be freed

Definition at line 4253 of file evhtp.c.

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

## evhtp_callback_get_hooks()

EVHTP_EXPORT evhtp_hooks_t * evhtp_callback_get_hooks | ( | evhtp_callback_t * | cb | ) |

returns callback hooks

Parameters

  cb |

Returns

Definition at line 4483 of file evhtp.c.

## evhtp_callback_new()

EVHTP_EXPORT evhtp_callback_t * evhtp_callback_new | ( | const char * | path,
|  | evhtp_callback_type | type,
|  | evhtp_callback_cb | cb,
|  | void * | arg )

creates a new evhtp_callback_t structure.

All callbacks are stored in this structure which define what the final function to be called after all parsing is done. A callback can be either a static string or a regular expression.

Parameters

  path | can either be a static path (/path/to/resource/) or a POSIX compatible regular expression (^/resource/(.*))
  type | informs the function what type of of information is is contained within the path argument. This can either be callback_type_path, or callback_type_regex.
  cb | the callback function to be invoked
  arg | optional argument which is passed when the callback is executed.

Returns
  0 on success, -1 on error.

Definition at line 4186 of file evhtp.c.

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

## evhtp_callback_set_hook()

EVHTP_EXPORT int evhtp_callback_set_hook | ( | evhtp_callback_t * | cb,
|  | evhtp_hook_type | type,
|  | evhtp_hook | hookcb,
|  | void * | arg )

Definition at line 4392 of file evhtp.c.

Here is the call graph for this function:

## evhtp_callback_unset_hook()

EVHTP_EXPORT int evhtp_callback_unset_hook | ( | evhtp_callback_t * | callback,
|  | evhtp_hook_type | type )

Definition at line 4374 of file evhtp.c.

Here is the call graph for this function:

## evhtp_callbacks_add_callback()

EVHTP_EXPORT int evhtp_callbacks_add_callback | ( | evhtp_callbacks_t * | cbs,
|  | evhtp_callback_t * | cb )

Adds a evhtp_callback_t to the evhtp_callbacks_t list.

Parameters

  cbs | an allocated evhtp_callbacks_t structure
  cb | an initialized evhtp_callback_t structure

Returns
  0 on success, -1 on error

Definition at line 4283 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_connection_disable_flag()

EVHTP_EXPORT void evhtp_connection_disable_flag | ( | evhtp_connection_t * | ,
|  | int | )

## evhtp_connection_enable_flag()

EVHTP_EXPORT void evhtp_connection_enable_flag | ( | evhtp_connection_t * | ,
|  | int | )

## evhtp_connection_free()

EVHTP_EXPORT void evhtp_connection_free | ( | evhtp_connection_t * | connection | ) |

free's all connection related resources, this will also call your request fini hook and request fini hook.

Parameters

  connection |

Definition at line 5066 of file evhtp.c.

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

## evhtp_connection_get_bev()

EVHTP_EXPORT struct bufferevent * evhtp_connection_get_bev | ( | evhtp_connection_t * | conn | ) |

returns the underlying connections bufferevent

Parameters

  conn |

Returns
  bufferevent on success, otherwise NULL

Definition at line 4950 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_connection_get_flags()

EVHTP_EXPORT int evhtp_connection_get_flags | ( | evhtp_connection_t * |  | ) |

## evhtp_connection_get_hooks()

EVHTP_EXPORT evhtp_hooks_t * evhtp_connection_get_hooks | ( | evhtp_connection_t * | c | ) |

Definition at line 4451 of file evhtp.c.

## evhtp_connection_new()

EVHTP_EXPORT evhtp_connection_t * evhtp_connection_new | ( | struct event_base * | evbase,
|  | const char * | addr,
|  | uint16_t | port )

allocate a new connection

Definition at line 5378 of file evhtp.c.

Here is the call graph for this function:

## evhtp_connection_new_dns()

EVHTP_EXPORT evhtp_connection_t * evhtp_connection_new_dns | ( | struct event_base * | evbase,
|  | struct evdns_base * | dns_base,
|  | const char * | addr,
|  | uint16_t | port )

allocate a new connection

Definition at line 5384 of file evhtp.c.

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

## evhtp_connection_pause()

EVHTP_EXPORT void evhtp_connection_pause | ( | evhtp_connection_t * | connection | ) |

pauses a connection (disables reading)

Parameters

  c | a evhtp_connection_t * structure

Definition at line 3034 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_connection_resume()

EVHTP_EXPORT void evhtp_connection_resume | ( | evhtp_connection_t * | connection | ) |

resumes a connection (enables reading) and activates resume event.

Parameters

  c |

Definition at line 3056 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_connection_set_bev()

EVHTP_EXPORT void evhtp_connection_set_bev | ( | evhtp_connection_t * | conn,
|  | struct bufferevent * | bev )

Sets the connections underlying bufferevent.

Parameters

  conn |
  bev |

Definition at line 4994 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_connection_set_hook()

EVHTP_EXPORT int evhtp_connection_set_hook | ( | evhtp_connection_t * | c,
|  | evhtp_hook_type | type,
|  | evhtp_hook | cb,
|  | void * | arg )

sets a callback hook for either a connection or a path/regex .

A user may set a variety of hooks either per-connection, or per-callback. This allows the developer to hook into various parts of the request processing cycle.

a per-connection hook can be set at any time, but it is recommended to set these during either a pre-accept phase, or post-accept phase. This allows a developer to set hooks before any other hooks are called.

a per-callback hook works differently. In this mode a developer can setup a set of hooks prior to starting the event loop for specific callbacks. For example if you wanted to hook something ONLY for a callback set by evhtp_set_cb or evhtp_set_regex_cb this is the method of doing so.

per-callback example:

evhtp_callback_t * cb = evhtp_set_regex_cb(htp, "/anything/(.*)", default_cb, NULL);

evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, anything_headers_cb, NULL);

evhtp_set_hook(&cb->hooks, evhtp_hook_on_fini, anything_fini_cb, NULL);

With the above example, once libevhtp has determined that it has a user-defined callback for /anything/.*; anything_headers_cb will be executed after all headers have been parsed, and anything_fini_cb will be executed before the request is free()'d.

The same logic applies to per-connection hooks, but it should be noted that if a per-callback hook is set, the per-connection hook will be ignored.

Parameters

  hooks | double pointer to the evhtp_hooks_t structure
  type | the hook type
  cb | the callback to be executed.
  arg | optional argument which is passed when the callback is executed

Returns
  0 on success, -1 on error (if hooks is NULL, it is allocated)

Definition at line 4405 of file evhtp.c.

Here is the call graph for this function:

## evhtp_connection_set_max_body_size()

EVHTP_EXPORT void evhtp_connection_set_max_body_size | ( | evhtp_connection_t * | conn,
|  | uint64_t | len )

set a max body size for a specific connection, this will default to the size set by evhtp_set_max_body_size

Parameters

  conn |
  len |

Definition at line 5050 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_connection_set_timeouts()

EVHTP_EXPORT void evhtp_connection_set_timeouts | ( | evhtp_connection_t * | conn,
|  | const struct timeval * | r,
|  | const struct timeval * | w )

inline

sets a connection-specific read/write timeout which overrides the global read/write settings.

Parameters

  conn |
  r | timeval for read
  w | timeval for write

Definition at line 5038 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_connection_ssl_new()

EVHTP_EXPORT evhtp_connection_t * evhtp_connection_ssl_new | ( | struct event_base * | evbase,
|  | const char * | addr,
|  | uint16_t | port,
|  | evhtp_ssl_ctx_t * | ctx )

Definition at line 5455 of file evhtp.c.

Here is the call graph for this function:

## evhtp_connection_take_ownership()

EVHTP_EXPORT struct bufferevent * evhtp_connection_take_ownership | ( | evhtp_connection_t * | connection | ) |

let a user take ownership of the underlying bufferevent and free all other underlying resources.

Warning: this will free all evhtp_connection/request structures, remove all associated hooks and reset the bufferevent to defaults, i.e., disable EV_READ, and set all callbacks to NULL.

Parameters

  connection |

Returns
  underlying connections bufferevent.

Definition at line 4956 of file evhtp.c.

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

## evhtp_connection_unset_hook()

EVHTP_EXPORT int evhtp_connection_unset_hook | ( | evhtp_connection_t * | conn,
|  | evhtp_hook_type | type )

Definition at line 4386 of file evhtp.c.

Here is the call graph for this function:

## evhtp_disable_100_continue()

EVHTP_EXPORT void evhtp_disable_100_continue | ( | evhtp_t * | htp | ) |

when a client sends an Expect: 100-continue, if this is function is called, evhtp will not send a HTTP/x.x continue response.

Parameters

  htp |

## evhtp_disable_flag()

EVHTP_EXPORT void evhtp_disable_flag | ( | evhtp_t * | ,
|  | int | )

## evhtp_enable_flag()

EVHTP_EXPORT void evhtp_enable_flag | ( | evhtp_t * | ,
|  | int | )

## evhtp_free()

EVHTP_EXPORT void evhtp_free | ( | evhtp_t * | evhtp | ) |

Frees evhtp_t structure; will stop and free threads associated with the structure, and free the ssl context as well (if applicable).

Parameters

  evhtp | - ptr to evhtp_t structure

Definition at line 5330 of file evhtp.c.

Here is the call graph for this function:

## evhtp_get_cb()

EVHTP_EXPORT evhtp_callback_t * evhtp_get_cb | ( | evhtp_t * | htp,
|  | const char * | needle )

attempts to find the callback matching the exact string 'needle'.

This is useful in cases where we want to get the original handle, but is not in scope.

with pattern based callbacks, this does not attempt to find a callback that would match the string if the pattern matcher was executed.

Meaning: evhtp_set_glob_cb(htp, "/foo/bar*", ....);

Calling evhtp_get_cb(htp, "/foo/bar/baz");

Will return NULL since it's not the exact pattern set

Calling evhtp_get_cb(htp, "/foo/bar*");

Is the correct usage.

Parameters

  htp |
  needle |

Returns
  NULL if callback is not not found

Definition at line 4524 of file evhtp.c.

## evhtp_get_flags()

EVHTP_EXPORT int evhtp_get_flags | ( | evhtp_t * |  | ) |

## evhtp_header_find()

EVHTP_EXPORT const char * evhtp_header_find | ( | evhtp_headers_t * | headers,
|  | const char * | key )

finds the value of a key in a evhtp_headers_t structure

Parameters

  headers | the evhtp_headers_t tailq
  key | the key to find

Returns
  the value of the header key if found, NULL if not found.

Definition at line 3311 of file evhtp.c.

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

## evhtp_header_key_add()

EVHTP_EXPORT evhtp_header_t * evhtp_header_key_add | ( | evhtp_headers_t * | headers,
|  | const char * | key,
|  | char | kalloc )

creates a new evhtp_header_t, sets only the key, and adds to the evhtp_headers TAILQ

Parameters

  headers | the evhtp_headers_t TAILQ (evhtp_kv_t)
  key | a null terminated string
  kalloc | if 1 the string will be copied, otherwise assigned

Returns
  an evhtp_header_t pointer or NULL on error

Definition at line 3092 of file evhtp.c.

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

## evhtp_header_new()

EVHTP_EXPORT evhtp_header_t * evhtp_header_new | ( | const char * | key,
|  | const char * | val,
|  | char | kalloc,
|  | char | valloc )

creates a new evhtp_header_t key/val structure

Parameters

  key | a null terminated string
  val | a null terminated string
  kalloc | if 1, key will be copied, if 0 no copy performed
  valloc | if 1, val will be copied, if 0 no copy performed

Returns
  evhtp_header_t * or NULL on error

Definition at line 3323 of file evhtp.c.

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

## evhtp_header_val_add()

EVHTP_EXPORT evhtp_header_t * evhtp_header_val_add | ( | evhtp_headers_t * | headers,
|  | const char * | val,
|  | char | valloc )

finds the last header in the headers tailq and adds the value

Parameters

  headers | the evhtp_headers_t TAILQ (evhtp_kv_t)
  val | a null terminated string
  valloc | if 1 the string will be copied, otherwise assigned

Returns
  an evhtp_header_t pointer or NULL on error

Definition at line 3106 of file evhtp.c.

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

## evhtp_headers_add_header()

EVHTP_EXPORT void evhtp_headers_add_header | ( | evhtp_headers_t * | headers,
|  | evhtp_header_t * | header )

adds an evhtp_header_t to the end of the evhtp_headers_t tailq

Parameters

  headers |
  header |

Definition at line 3317 of file evhtp.c.

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

## evhtp_kv_find()

EVHTP_EXPORT const char * evhtp_kv_find | ( | evhtp_kvs_t * | kvs,
|  | const char * | key )

find the string value of 'key' from the key/value list 'kvs'

Parameters

  kvs |
  key |

Returns
  NULL if not found

Definition at line 3293 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_kv_free()

EVHTP_EXPORT void evhtp_kv_free | ( | evhtp_kv_t * | kv | ) |

frees resources allocated for a single key/value

Parameters

  kv |

Definition at line 3219 of file evhtp.c.

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

## evhtp_kv_new()

EVHTP_EXPORT evhtp_kv_t * evhtp_kv_new | ( | const char * | key,
|  | const char * | val,
|  | char | kalloc,
|  | char | valloc )

Allocates a new key/value structure.

Parameters

  key | null terminated string
  val | null terminated string
  kalloc | if set to 1, the key will be copied, if 0 no copy is done.
  valloc | if set to 1, the val will be copied, if 0 no copy is done.

Returns
  evhtp_kv_t * on success, NULL on error.

Definition at line 3156 of file evhtp.c.

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

## evhtp_kv_rm_and_free()

EVHTP_EXPORT void evhtp_kv_rm_and_free | ( | evhtp_kvs_t * | kvs,
|  | evhtp_kv_t * | kv )

free's resources associated with 'kv' if ONLY found within the key/value list

Parameters

  kvs |
  kv |

Definition at line 3237 of file evhtp.c.

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

## evhtp_kvs_add_kv()

EVHTP_EXPORT void evhtp_kvs_add_kv | ( | evhtp_kvs_t * | kvs,
|  | evhtp_kv_t * | kv )

appends a key/val structure to a evhtp_kvs_t tailq

Parameters

  kvs | an evhtp_kvs_t structure
  kv | an evhtp_kv_t structure

Definition at line 3347 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_kvs_add_kvs()

EVHTP_EXPORT void evhtp_kvs_add_kvs | ( | evhtp_kvs_t * | dst,
|  | evhtp_kvs_t * | src )

appends all key/val structures from src tailq onto dst tailq

Parameters

  dst | an evhtp_kvs_t structure
  src | an evhtp_kvs_t structure

Definition at line 3357 of file evhtp.c.

Here is the call graph for this function:

## evhtp_kvs_find_kv()

EVHTP_EXPORT evhtp_kv_t * evhtp_kvs_find_kv | ( | evhtp_kvs_t * | kvs,
|  | const char * | key )

find the evhtp_kv_t reference 'key' from the k/val list 'kvs'

Parameters

  kvs |
  key |

Returns

Definition at line 3329 of file evhtp.c.

## evhtp_kvs_for_each()

EVHTP_EXPORT int evhtp_kvs_for_each | ( | evhtp_kvs_t * | kvs,
|  | evhtp_kvs_iterator | cb,
|  | void * | arg )

callback iterator which executes 'cb' for every entry in 'kvs'

Parameters

  kvs |
  cb |
  arg |

Returns

Definition at line 3273 of file evhtp.c.

## evhtp_kvs_free()

EVHTP_EXPORT void evhtp_kvs_free | ( | evhtp_kvs_t * | kvs | ) |

frees a the list of key/values, and all underlying entries

Parameters

  kvs |

Definition at line 3249 of file evhtp.c.

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

## evhtp_kvs_new()

EVHTP_EXPORT evhtp_kvs_t * evhtp_kvs_new | ( | void |  | ) |

creates an empty list of key/values

Returns

Definition at line 3140 of file evhtp.c.

Here is the call graph for this function:

## evhtp_make_request()

EVHTP_EXPORT int evhtp_make_request | ( | evhtp_connection_t * | c,
|  | evhtp_request_t * | r,
|  | htp_method | meth,
|  | const char * | uri )

make a client request

Definition at line 5541 of file evhtp.c.

Here is the call graph for this function:

## evhtp_new()

EVHTP_EXPORT evhtp_t * evhtp_new | ( | struct event_base * | evbase,
|  | void * | arg )

creates a new evhtp_t instance

Parameters

  evbase | the initialized event base
  arg | user-defined argument which is evhtp_t specific

Returns
  a new evhtp_t structure or NULL on error

Definition at line 5318 of file evhtp.c.

Here is the call graph for this function:

## evhtp_parse_query()

EVHTP_EXPORT evhtp_query_t * evhtp_parse_query | ( | const char * | query,
|  | size_t | len )

Parses the query portion of the uri into a set of key/values in a strict manner.

Parses query arguments like "?herp=derp&foo=bar&blah=baz"

Parameters

  query | data containing the uri query arguments
  len | size of the data

Returns
  evhtp_query_t * on success, NULL on error

Definition at line 3745 of file evhtp.c.

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

## evhtp_parse_query_wflags()

EVHTP_EXPORT evhtp_query_t * evhtp_parse_query_wflags | ( | const char * | query,
|  | size_t | len,
|  | int | flags )

Parses the query portion of the uri into a set of key/values.

Parses query arguments like "?herp=&foo=bar;blah=baz&a=%3"

Parameters

  query | data containing the uri query arguments
  len | size of the data
  flags | parse query flags to alter 'strictness' (see EVHTP_PARSE_QUERY_FLAG_*)

Returns
  evhtp_query_t * on success, NULL on error

Definition at line 3486 of file evhtp.c.

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

## evhtp_request_disable_flag()

EVHTP_EXPORT void evhtp_request_disable_flag | ( | evhtp_request_t * | ,
|  | int | )

## evhtp_request_enable_flag()

EVHTP_EXPORT void evhtp_request_enable_flag | ( | evhtp_request_t * | ,
|  | int | )

## evhtp_request_free()

EVHTP_EXPORT void evhtp_request_free | ( | evhtp_request_t * | request | ) |

Definition at line 5103 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_get_bev()

EVHTP_EXPORT struct bufferevent * evhtp_request_get_bev | ( | evhtp_request_t * | request | ) |

returns the underlying requests bufferevent

Parameters

  request |

Returns
  bufferevent on success, otherwise NULL

Definition at line 4982 of file evhtp.c.

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

## evhtp_request_get_connection()

EVHTP_EXPORT evhtp_connection_t * evhtp_request_get_connection | ( | evhtp_request_t * | request | ) |

returns the underlying evhtp_connection_t structure from a request

Parameters

  request |

Returns
  evhtp_connection_t on success, otherwise NULL

Definition at line 5014 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_request_get_flags()

EVHTP_EXPORT int evhtp_request_get_flags | ( | evhtp_request_t * |  | ) |

## evhtp_request_get_hooks()

EVHTP_EXPORT evhtp_hooks_t * evhtp_request_get_hooks | ( | evhtp_request_t * | r | ) |

returns request hooks

Parameters

  r |

Returns

Definition at line 4467 of file evhtp.c.

## evhtp_request_get_method()

EVHTP_EXPORT htp_method evhtp_request_get_method | ( | evhtp_request_t * | r | ) |

returns the htp_method enum version of the request method.

Parameters

  r |

Returns
  htp_method enum

Definition at line 3024 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_get_proto()

EVHTP_EXPORT evhtp_proto evhtp_request_get_proto | ( | evhtp_request_t * | r | ) |

Definition at line 5020 of file evhtp.c.

## evhtp_request_get_status_code()

EVHTP_EXPORT evhtp_res evhtp_request_get_status_code | ( | evhtp_request_t * | r | ) |

Returns the last status code set for a request (request/response).

Parameters

  r |

Returns
  the HTTP status code or related error.

Definition at line 5026 of file evhtp.c.

## evhtp_request_get_status_code_str()

EVHTP_EXPORT const char * evhtp_request_get_status_code_str | ( | evhtp_request_t * | r | ) |

wrapper around get_status_code that returns the string version of the last status code set for a request.

Parameters

  r |

Returns
  NULL on error

Definition at line 5032 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_new()

EVHTP_EXPORT evhtp_request_t * evhtp_request_new | ( | evhtp_callback_cb | cb,
|  | void * | arg )

allocate a new request

Definition at line 5526 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_pause()

EVHTP_EXPORT void evhtp_request_pause | ( | evhtp_request_t * | request | ) |

Wrapper around evhtp_connection_pause.

See also
  evhtp_connection_pause

Parameters

  request |

Definition at line 3075 of file evhtp.c.

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

## evhtp_request_resume()

EVHTP_EXPORT void evhtp_request_resume | ( | evhtp_request_t * | request | ) |

Wrapper around evhtp_connection_resume.

See also
  evhtp_connection_resume

Parameters

  request |

Definition at line 3084 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_set_bev()

EVHTP_EXPORT void evhtp_request_set_bev | ( | evhtp_request_t * | request,
|  | struct bufferevent * | bev )

sets the underlying bufferevent for a evhtp_request

Parameters

  request |
  bev |

Definition at line 5000 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_set_hook()

EVHTP_EXPORT int evhtp_request_set_hook | ( | evhtp_request_t * | r,
|  | evhtp_hook_type | type,
|  | evhtp_hook | cb,
|  | void * | arg )

Definition at line 4399 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_set_keepalive()

EVHTP_EXPORT void evhtp_request_set_keepalive | ( | evhtp_request_t * | request,
|  | int | val )

Definition at line 5006 of file evhtp.c.

## evhtp_request_set_max_body_size()

EVHTP_EXPORT void evhtp_request_set_max_body_size | ( | evhtp_request_t * | request,
|  | uint64_t | len )

just calls evhtp_connection_set_max_body_size for the request.

Parameters

  request |
  len |

Definition at line 5060 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_status()

EVHTP_EXPORT unsigned int evhtp_request_status | ( | evhtp_request_t * | r | ) |

Definition at line 5589 of file evhtp.c.

Here is the call graph for this function:

## evhtp_request_unset_hook()

EVHTP_EXPORT int evhtp_request_unset_hook | ( | evhtp_request_t * | req,
|  | evhtp_hook_type | type )

Definition at line 4380 of file evhtp.c.

Here is the call graph for this function:

## evhtp_response_needs_body()

EVHTP_EXPORT int evhtp_response_needs_body | ( | const evhtp_res | code,
|  | const htp_method | method )

Determine if a response should have a body.

Follows the rules in RFC 2616 section 4.3.

Returns
  1 if the response MUST have a body; 0 if the response MUST NOT have a body.

Definition at line 3811 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_send_reply()

EVHTP_EXPORT void evhtp_send_reply | ( | evhtp_request_t * | request,
|  | evhtp_res | code )

generates all the right information for a reply to be sent to the client

Parameters

  request |
  code | HTTP return status code

Definition at line 3785 of file evhtp.c.

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

## evhtp_send_reply_body()

EVHTP_EXPORT void evhtp_send_reply_body | ( | evhtp_request_t * | request,
|  | struct evbuffer * | buf )

Definition at line 3769 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_send_reply_chunk()

EVHTP_EXPORT void evhtp_send_reply_chunk | ( | evhtp_request_t * | request,
|  | struct evbuffer * | buf )

send a chunk reply.

Parameters

  request |
  buf |

Definition at line 3888 of file evhtp.c.

Here is the call graph for this function:

## evhtp_send_reply_chunk_end()

EVHTP_EXPORT void evhtp_send_reply_chunk_end | ( | evhtp_request_t * | request | ) |

call when all chunks have been sent and you wish to send the last bits.

This will add the last 0CRLFCRCL and call send_reply_end().

Parameters

  request |

Definition at line 3913 of file evhtp.c.

Here is the call graph for this function:

## evhtp_send_reply_chunk_start()

EVHTP_EXPORT void evhtp_send_reply_chunk_start | ( | evhtp_request_t * | request,
|  | evhtp_res | code )

start a chunked response.

If data already exists on the output buffer, this will be converted to the first chunk.

Parameters

  request |
  code |

Definition at line 3820 of file evhtp.c.

Here is the call graph for this function:

## evhtp_send_reply_end()

EVHTP_EXPORT void evhtp_send_reply_end | ( | evhtp_request_t * | request | ) |

Definition at line 3779 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_send_reply_start()

EVHTP_EXPORT void evhtp_send_reply_start | ( | evhtp_request_t * | request,
|  | evhtp_res | code )

Definition at line 3752 of file evhtp.c.

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

## evhtp_set_bev_flags()

EVHTP_EXPORT void evhtp_set_bev_flags | ( | evhtp_t * | htp,
|  | int | flags )

bufferevent flags which will be used for bev sockets.

Parameters

  htp |
  flags |

Definition at line 5131 of file evhtp.c.

## evhtp_set_cb()

EVHTP_EXPORT evhtp_callback_t * evhtp_set_cb | ( | evhtp_t * | htp,
|  | const char * | path,
|  | evhtp_callback_cb | cb,
|  | void * | arg )

sets a callback to be executed on a specific path

Parameters

  htp | the initialized evhtp_t
  path | the path to match
  cb | the function to be executed
  arg | user-defined argument passed to the callback

Returns
  evhtp_callback_t * on success, NULL on error.

Definition at line 4489 of file evhtp.c.

Here is the call graph for this function:

## evhtp_set_gencb()

EVHTP_EXPORT void evhtp_set_gencb | ( | evhtp_t * | htp,
|  | evhtp_callback_cb | cb,
|  | void * | arg )

sets a callback which is called if no other callbacks are matched

Parameters

  htp | the initialized evhtp_t
  cb | the function to be executed
  arg | user-defined argument passed to the callback

Definition at line 4705 of file evhtp.c.

Here is the caller graph for this function:

## evhtp_set_glob_cb()

EVHTP_EXPORT evhtp_callback_t * evhtp_set_glob_cb | ( | evhtp_t * | htp,
|  | const char * | pattern,
|  | evhtp_callback_cb | cb,
|  | void * | arg )

sets a callback to to be executed on simple glob/wildcard patterns this is useful if the app does not care about what was matched, but just that it matched.

This is technically faster than regex.

Parameters

  htp |
  pattern | wildcard pattern, the '*' can be set at either or both the front or end.
  cb |
  arg |

Returns

Definition at line 4670 of file evhtp.c.

Here is the call graph for this function:

## evhtp_set_max_body_size()

EVHTP_EXPORT void evhtp_set_max_body_size | ( | evhtp_t * | htp,
|  | uint64_t | len )

set a max body size to accept for an incoming request, this will default to unlimited.

Parameters

  htp |
  len |

Definition at line 5137 of file evhtp.c.

## evhtp_set_max_keepalive_requests()

EVHTP_EXPORT void evhtp_set_max_keepalive_requests | ( | evhtp_t * | htp,
|  | uint64_t | num )

sets a maximum number of requests that a single connection can make.

Parameters

  htp |
  num |

Definition at line 5125 of file evhtp.c.

## evhtp_set_mem_functions()

EVHTP_EXPORT void evhtp_set_mem_functions | ( | void *(* | malloc_ )(size_t),
|  | void *(* | realloc_ )(void *, size_t),
|  | void(* | free_ )(void *) )

Definition at line 321 of file evhtp.c.

## evhtp_set_parser_flags()

EVHTP_EXPORT void evhtp_set_parser_flags | ( | evhtp_t * | htp,
|  | int | flags )

during the request processing cycle, these flags will be used to for query argument parsing.

i.e., what to parse and not to parse.

SEE: EVHTP_PARSE_QUERY_* stuff.

For example, if you do not wish for the streaming parser attempting the act of fragment parsing: evhtp_set_parser_flags(htp, EVHTP_PARSE_QUERY_FLAG_IGNORE_FRAGMENTS);

Parameters

  htp |
  flags |

Definition at line 5149 of file evhtp.c.

## evhtp_set_post_accept_cb()

EVHTP_EXPORT void evhtp_set_post_accept_cb | ( | evhtp_t * | htp,
|  | evhtp_post_accept_cb | cb,
|  | void * | arg )

call a user-defined function right after a connection is accepted.

Parameters

  htp |
  evhtp_post_accept_cb |
  arg |

Returns

Definition at line 4719 of file evhtp.c.

## evhtp_set_pre_accept_cb()

EVHTP_EXPORT void evhtp_set_pre_accept_cb | ( | evhtp_t * | htp,
|  | evhtp_pre_accept_cb | cb,
|  | void * | arg )

call a user-defined function before the connection is accepted.

Parameters

  htp |
  evhtp_pre_accept_cb |
  arg |

Returns

Definition at line 4712 of file evhtp.c.

## evhtp_set_regex_cb()

EVHTP_EXPORT evhtp_callback_t * evhtp_set_regex_cb | ( | evhtp_t * | htp,
|  | const char * | pattern,
|  | evhtp_callback_cb | cb,
|  | void * | arg )

sets a callback to be executed based on a regex pattern

Parameters

  htp | the initialized evhtp_t
  pattern | a POSIX compat regular expression
  cb | the function to be executed
  arg | user-defined argument passed to the callback

Returns
  evhtp_callback_t * on success, NULL on error

Definition at line 4630 of file evhtp.c.

Here is the call graph for this function:

## evhtp_set_timeouts()

EVHTP_EXPORT void evhtp_set_timeouts | ( | evhtp_t * | htp,
|  | const struct timeval * | r,
|  | const struct timeval * | w )

set a read/write timeout on all things evhtp_t.

When the timeout expires your error hook will be called with the libevent supplied event flags.

Parameters

  htp | the base evhtp_t struct
  r | read-timeout in timeval
  w | write-timeout in timeval.

Definition at line 5113 of file evhtp.c.

## evhtp_ssl_init()

EVHTP_EXPORT int evhtp_ssl_init | ( | evhtp_t * | htp,
|  | evhtp_ssl_cfg_t * | ssl_cfg )

Definition at line 4762 of file evhtp.c.

Here is the call graph for this function:

## evhtp_ssl_use_threads()

EVHTP_EXPORT int evhtp_ssl_use_threads | ( | void |  | ) |

Definition at line 4728 of file evhtp.c.

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

## evhtp_unbind_socket()

EVHTP_EXPORT void evhtp_unbind_socket | ( | evhtp_t * | htp | ) |

stops the listening socket.

Parameters

  htp |

Definition at line 3924 of file evhtp.c.

## evhtp_unescape_string()

EVHTP_EXPORT int evhtp_unescape_string | ( | unsigned char ** | out,
|  | unsigned char * | str,
|  | size_t | str_len )

Unescapes strings like '%7B1,%202,%203%7D' would become '{1, 2, 3}'.

Parameters

  out | double pointer where output is stored. This is allocated by the user.
  str | the string to unescape
  str_len | the length of the string to unescape

Returns
  0 on success, -1 on error

Definition at line 3413 of file evhtp.c.

## evhtp_unset_all_hooks()

EVHTP_EXPORT int evhtp_unset_all_hooks | ( | evhtp_hooks_t ** | hooks | ) |

removes all hooks.

Parameters

  hooks |

Returns

Definition at line 4412 of file evhtp.c.

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

## evhtp_use_callback_locks()

EVHTP_EXPORT int evhtp_use_callback_locks | ( | evhtp_t * | htp | ) |

creates a lock around callbacks and hooks, allowing for threaded applications to add/remove/modify hooks & callbacks in a thread-safe manner.

Parameters

  htp |

Returns
  0 on success, -1 on error

Definition at line 4613 of file evhtp.c.

Here is the call graph for this function:

## evhtp_use_threads()

EVHTP_EXPORT int evhtp_use_threads | ( | evhtp_t * | htp,
|  | evhtp_thread_init_cb | init_cb,
|  | int | nthreads,
|  | void * | arg )

Enable thread-pool support for an evhtp_t context.

Connectios are distributed across 'nthreads'. An optional "on-start" callback can be set which allows you to manipulate the thread-specific inforation (such as the thread-specific event_base).

Parameters

  htp |
  init_cb |
  exit_cb |
  nthreads |
  arg |

Returns

Definition at line 4594 of file evhtp.c.

Here is the call graph for this function:

## evhtp_use_threads_wexit()

EVHTP_EXPORT int evhtp_use_threads_wexit | ( | evhtp_t * | htp,
|  | evhtp_thread_init_cb | init_cb,
|  | evhtp_thread_exit_cb | exit_cb,
|  | int | nthreads,
|  | void * | arg )

Temporary function which will be renamed evhtp_use_threads in the future.

evhtp_use_threads() has been noted as deprecated for now

Definition at line 4601 of file evhtp.c.

Here is the call graph for this function:

## TAILQ_HEAD()

TAILQ_HEAD | ( | evhtp_kvs | ,
|  | evhtp_kv | )

## Variable Documentation

## instead

EVHTP_EXPORT void use htp flags instead

Definition at line 611 of file evhtp/evhtp.h.