Libevhtp  1.2.13
evhtp/evhtp.h
Go to the documentation of this file.
1 
5 #include <evhtp/config.h>
6 
7 #ifndef __EVHTP__H__
8 #define __EVHTP__H__
9 
11 #ifndef EVHTP_DISABLE_EVTHR
12 #include <evhtp/thread.h>
13 #endif
14 
15 #include <evhtp/parser.h>
16 
17 #ifndef EVHTP_DISABLE_REGEX
18 #include <onigposix.h>
19 #endif
20 
21 #include <sys/queue.h>
22 #include <event2/event.h>
23 #include <event2/listener.h>
24 #include <event2/buffer.h>
25 #include <event2/bufferevent.h>
26 
27 #ifndef EVHTP_DISABLE_SSL
28 #include <event2/bufferevent_ssl.h>
29 #include <openssl/dh.h>
30 #include <openssl/ssl.h>
31 #include <openssl/err.h>
32 #include <openssl/rand.h>
33 #endif
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 struct evhtp_callback;
40 struct evhtp_callbacks;
41 struct evhtp_kvs;
42 
43 #ifndef EVHTP_DISABLE_SSL
44 typedef SSL_SESSION evhtp_ssl_sess_t;
45 typedef SSL evhtp_ssl_t;
46 typedef SSL_CTX evhtp_ssl_ctx_t;
47 typedef X509 evhtp_x509_t;
48 typedef X509_STORE_CTX evhtp_x509_store_ctx_t;
49 #if OPENSSL_VERSION_NUMBER < 0x10100000L
50 typedef unsigned char evhtp_ssl_data_t;
51 #else
52 typedef const unsigned char evhtp_ssl_data_t;
53 #endif
54 #else
55 typedef void evhtp_ssl_sess_t;
56 typedef void evhtp_ssl_t;
57 typedef void evhtp_ssl_ctx_t;
58 typedef void evhtp_x509_t;
59 typedef void evhtp_x509_store_ctx_t;
60 #endif
61 
62 typedef struct evbuffer evbuf_t;
63 typedef struct event event_t;
64 typedef struct evconnlistener evserv_t;
65 typedef struct bufferevent evbev_t;
66 
67 #ifdef EVHTP_DISABLE_EVTHR
68 typedef struct event_base evbase_t;
69 typedef void evthr_t;
70 typedef void evthr_pool_t;
71 typedef void evhtp_mutex_t;
72 #else
73 typedef pthread_mutex_t evhtp_mutex_t;
74 #endif
75 
76 typedef struct evhtp evhtp_t;
77 typedef struct evhtp_defaults evhtp_defaults_t;
78 typedef struct evhtp_callbacks evhtp_callbacks_t;
79 typedef struct evhtp_callback evhtp_callback_t;
80 typedef struct evhtp_kv evhtp_kv_t;
81 typedef struct evhtp_kvs evhtp_kvs_t;
82 typedef struct evhtp_uri evhtp_uri_t;
83 typedef struct evhtp_path evhtp_path_t;
84 typedef struct evhtp_authority evhtp_authority_t;
85 typedef struct evhtp_request evhtp_request_t;
86 typedef struct evhtp_hooks evhtp_hooks_t;
87 typedef struct evhtp_connection evhtp_connection_t;
88 typedef struct evhtp_ssl_cfg evhtp_ssl_cfg_t;
89 typedef struct evhtp_alias evhtp_alias_t;
90 typedef uint16_t evhtp_res;
91 typedef uint8_t evhtp_error_flags;
92 
93 typedef struct evhtp_kv evhtp_header_t;
94 typedef struct evhtp_kvs evhtp_headers_t;
95 typedef struct evhtp_kvs evhtp_query_t;
96 
102 };
103 
125 };
126 
130 #ifndef EVHTP_DISABLE_REGEX
132 #endif
133 };
134 
139 };
140 
144 };
145 
150 typedef enum evhtp_type evhtp_type;
151 
152 typedef void (* evhtp_thread_init_cb)(evhtp_t * htp, evthr_t * thr, void * arg);
153 typedef void (* evhtp_thread_exit_cb)(evhtp_t * htp, evthr_t * thr, void * arg);
154 typedef void (* evhtp_callback_cb)(evhtp_request_t * req, void * arg);
155 typedef void (* evhtp_hook_err_cb)(evhtp_request_t * req, evhtp_error_flags errtype, void * arg);
156 typedef void (* evhtp_hook_event_cb)(evhtp_connection_t * conn, short events, void * arg);
157 
158 /* Generic hook for passing ISO tests */
159 typedef evhtp_res (* evhtp_hook)();
160 
161 typedef evhtp_res (* evhtp_hook_conn_err_cb)(evhtp_connection_t * connection, evhtp_error_flags errtype, void * arg);
162 typedef evhtp_res (* evhtp_pre_accept_cb)(evhtp_connection_t * conn, void * arg);
163 typedef evhtp_res (* evhtp_post_accept_cb)(evhtp_connection_t * conn, void * arg);
164 typedef evhtp_res (* evhtp_hook_header_cb)(evhtp_request_t * req, evhtp_header_t * hdr, void * arg);
165 typedef evhtp_res (* evhtp_hook_headers_cb)(evhtp_request_t * req, evhtp_headers_t * hdr, void * arg);
166 typedef evhtp_res (* evhtp_hook_path_cb)(evhtp_request_t * req, evhtp_path_t * path, void * arg);
167 typedef evhtp_res (* evhtp_hook_read_cb)(evhtp_request_t * req, struct evbuffer * buf, void * arg);
168 typedef evhtp_res (* evhtp_hook_request_fini_cb)(evhtp_request_t * req, void * arg);
169 typedef evhtp_res (* evhtp_hook_connection_fini_cb)(evhtp_connection_t * connection, void * arg);
170 typedef evhtp_res (* evhtp_hook_chunk_new_cb)(evhtp_request_t * r, uint64_t len, void * arg);
171 typedef evhtp_res (* evhtp_hook_chunk_fini_cb)(evhtp_request_t * r, void * arg);
172 typedef evhtp_res (* evhtp_hook_chunks_fini_cb)(evhtp_request_t * r, void * arg);
173 typedef evhtp_res (* evhtp_hook_headers_start_cb)(evhtp_request_t * r, void * arg);
174 typedef evhtp_res (* evhtp_hook_hostname_cb)(evhtp_request_t * r, const char * hostname, void * arg);
175 typedef evhtp_res (* evhtp_hook_write_cb)(evhtp_connection_t * conn, void * arg);
176 
177 typedef int (* evhtp_kvs_iterator)(evhtp_kv_t * kv, void * arg);
178 typedef int (* evhtp_headers_iterator)(evhtp_header_t * header, void * arg);
179 
180 #ifndef EVHTP_DISABLE_SSL
181 typedef int (* evhtp_ssl_verify_cb)(int pre_verify, evhtp_x509_store_ctx_t * ctx);
183 typedef EVP_PKEY * (* evhtp_ssl_decrypt_cb)(char * privfile);
184 
185 typedef int (* evhtp_ssl_scache_add)(evhtp_connection_t * connection, evhtp_ssl_data_t * sid, int sid_len, evhtp_ssl_sess_t * sess);
186 typedef void (* evhtp_ssl_scache_del)(evhtp_t * htp, evhtp_ssl_data_t * sid, int sid_len);
187 typedef evhtp_ssl_sess_t * (* evhtp_ssl_scache_get)(evhtp_connection_t * connection, evhtp_ssl_data_t * sid, int sid_len);
188 
189 typedef void * (* evhtp_ssl_scache_init)(evhtp_t *);
190 #endif
191 
192 #define EVHTP_VERSION "1.2.18"
193 #define EVHTP_VERSION_MAJOR 1
194 #define EVHTP_VERSION_MINOR 2
195 #define EVHTP_VERSION_PATCH 18
196 
197 #define evhtp_headers_iterator evhtp_kvs_iterator
198 
199 #define EVHTP_RES_ERROR 0
200 #define EVHTP_RES_PAUSE 1
201 #define EVHTP_RES_FATAL 2
202 #define EVHTP_RES_USER 3
203 #define EVHTP_RES_DATA_TOO_LONG 4
204 #define EVHTP_RES_OK 200
205 
206 #ifndef DOXYGEN_SHOULD_SKIP_THIS
207 #define EVHTP_RES_100 100
208 #define EVHTP_RES_CONTINUE 100
209 #define EVHTP_RES_SWITCH_PROTO 101
210 #define EVHTP_RES_PROCESSING 102
211 #define EVHTP_RES_URI_TOOLONG 122
212 
213 #define EVHTP_RES_200 200
214 #define EVHTP_RES_CREATED 201
215 #define EVHTP_RES_ACCEPTED 202
216 #define EVHTP_RES_NAUTHINFO 203
217 #define EVHTP_RES_NOCONTENT 204
218 #define EVHTP_RES_RSTCONTENT 205
219 #define EVHTP_RES_PARTIAL 206
220 #define EVHTP_RES_MSTATUS 207
221 #define EVHTP_RES_IMUSED 226
222 
223 #define EVHTP_RES_300 300
224 #define EVHTP_RES_MCHOICE 300
225 #define EVHTP_RES_MOVEDPERM 301
226 #define EVHTP_RES_FOUND 302
227 #define EVHTP_RES_SEEOTHER 303
228 #define EVHTP_RES_NOTMOD 304
229 #define EVHTP_RES_USEPROXY 305
230 #define EVHTP_RES_SWITCHPROXY 306
231 #define EVHTP_RES_TMPREDIR 307
232 
233 #define EVHTP_RES_400 400
234 #define EVHTP_RES_BADREQ 400
235 #define EVHTP_RES_UNAUTH 401
236 #define EVHTP_RES_PAYREQ 402
237 #define EVHTP_RES_FORBIDDEN 403
238 #define EVHTP_RES_NOTFOUND 404
239 #define EVHTP_RES_METHNALLOWED 405
240 #define EVHTP_RES_NACCEPTABLE 406
241 #define EVHTP_RES_PROXYAUTHREQ 407
242 #define EVHTP_RES_TIMEOUT 408
243 #define EVHTP_RES_CONFLICT 409
244 #define EVHTP_RES_GONE 410
245 #define EVHTP_RES_LENREQ 411
246 #define EVHTP_RES_PRECONDFAIL 412
247 #define EVHTP_RES_ENTOOLARGE 413
248 #define EVHTP_RES_URITOOLARGE 414
249 #define EVHTP_RES_UNSUPPORTED 415
250 #define EVHTP_RES_RANGENOTSC 416
251 #define EVHTP_RES_EXPECTFAIL 417
252 #define EVHTP_RES_IAMATEAPOT 418
253 
254 #define EVHTP_RES_500 500
255 #define EVHTP_RES_SERVERR 500
256 #define EVHTP_RES_NOTIMPL 501
257 #define EVHTP_RES_BADGATEWAY 502
258 #define EVHTP_RES_SERVUNAVAIL 503
259 #define EVHTP_RES_GWTIMEOUT 504
260 #define EVHTP_RES_VERNSUPPORT 505
261 #define EVHTP_RES_BWEXEED 509
262 #endif
263 
268  void * cbarg;
271 };
272 
273 struct evhtp_alias {
274  char * alias;
275 
276  TAILQ_ENTRY(evhtp_alias) next;
277 };
278 
283 struct evhtp {
284  evhtp_t * parent;
285  struct event_base * evbase;
286  struct evconnlistener * server;
287  char * server_name;
288  void * arg;
289  int bev_flags;
290  uint64_t max_body_size;
292 
293  #define EVHTP_FLAG_ENABLE_100_CONT (1 << 1)
294  #define EVHTP_FLAG_ENABLE_REUSEPORT (1 << 2)
295  #define EVHTP_FLAG_ENABLE_NODELAY (1 << 3)
296  #define EVHTP_FLAG_ENABLE_DEFER_ACCEPT (1 << 4)
297  #define EVHTP_FLAG_DEFAULTS EVHTP_FLAG_ENABLE_100_CONT
298  #define EVHTP_FLAG_ENABLE_ALL EVHTP_FLAG_ENABLE_100_CONT \
299  | EVHTP_FLAG_ENABLE_REUSEPORT \
300  | EVHTP_FLAG_ENABLE_NODELAY \
301  | EVHTP_FLAG_ENABLE_DEFER_ACCEPT
302 
303  uint16_t flags;
304  uint16_t parser_flags;
306 #ifndef EVHTP_DISABLE_SSL
308  evhtp_ssl_cfg_t * ssl_cfg;
309 #endif
310 
311 #ifndef EVHTP_DISABLE_EVTHR
312  evthr_pool_t * thr_pool;
313  pthread_mutex_t * lock;
317 
318  /* keep backwards compat because I'm dumb and didn't
319  * make these structs private
320  */
321  #define thread_init_cbarg thread_cbarg
322  void * thread_cbarg;
323 #endif
325  evhtp_defaults_t defaults;
326 
327  struct timeval recv_timeo;
328  struct timeval send_timeo;
329 
330  TAILQ_HEAD(, evhtp_alias) aliases;
331  TAILQ_HEAD(, evhtp) vhosts;
332  TAILQ_ENTRY(evhtp) next_vhost;
333 };
334 
335 
339 struct evhtp_kv {
340  char * key;
341  char * val;
342 
343  size_t klen;
344  size_t vlen;
345 
346  char k_heaped;
347  char v_heaped;
349  TAILQ_ENTRY(evhtp_kv) next;
350 };
351 
352 TAILQ_HEAD(evhtp_kvs, evhtp_kv);
353 
354 
355 
359 struct evhtp_uri {
360  evhtp_authority_t * authority;
361  evhtp_path_t * path;
362  unsigned char * fragment;
363  unsigned char * query_raw;
365  htp_scheme scheme;
366 };
367 
368 
373  char * username;
374  char * password;
375  char * hostname;
376  uint16_t port;
377 };
378 
379 
383 struct evhtp_path {
384  char * full;
385  char * path;
386  char * file;
387  char * match_start;
388  char * match_end;
389  unsigned int matched_soff;
392  unsigned int matched_eoff;
395 };
396 
397 
402  evhtp_t * htp;
403  evhtp_connection_t * conn;
404  evhtp_hooks_t * hooks;
405  evhtp_uri_t * uri;
406  struct evbuffer * buffer_in;
407  struct evbuffer * buffer_out;
411  htp_method method;
413  #define EVHTP_REQ_FLAG_KEEPALIVE (1 << 1)
414  #define EVHTP_REQ_FLAG_FINISHED (1 << 2)
415  #define EVHTP_REQ_FLAG_CHUNKED (1 << 3)
416  #define EVHTP_REQ_FLAG_ERROR (1 << 4)
417  uint16_t flags;
418 
420  void * cbarg;
423 };
424 
425 #define evhtp_request_content_len(r) htparser_get_content_length(r->conn->parser)
426 
428  evhtp_t * htp;
429  struct event_base * evbase;
430  struct bufferevent * bev;
431 #ifndef EVHTP_DISABLE_EVTHR
432  evthr_t * thread;
433 #endif
434 #ifndef EVHTP_DISABLE_SSL
436 #endif
437  evhtp_hooks_t * hooks;
439  struct event * resume_ev;
440  struct sockaddr * saddr;
441  struct timeval recv_timeo;
442  struct timeval send_timeo;
443  evutil_socket_t sock;
444  evhtp_request_t * request;
445  uint64_t max_body_size;
446  uint64_t body_bytes_read;
447  uint64_t num_requests;
449  #define EVHTP_CONN_FLAG_ERROR (1 << 1)
450  #define EVHTP_CONN_FLAG_OWNER (1 << 2)
451  #define EVHTP_CONN_FLAG_VHOST_VIA_SNI (1 << 3)
452  #define EVHTP_CONN_FLAG_PAUSED (1 << 4)
453  #define EVHTP_CONN_FLAG_CONNECTED (1 << 5)
454  #define EVHTP_CONN_FLAG_WAITING (1 << 6)
455  #define EVHTP_CONN_FLAG_FREE_CONN (1 << 7)
456  #define EVHTP_CONN_FLAG_KEEPALIVE (1 << 8)
457  uint16_t flags;
458 
459  struct evbuffer * scratch_buf;
461 #ifdef EVHTP_FUTURE_USE
462  TAILQ_HEAD(, evhtp_request) pending;
463 #endif
464 };
465 
466 struct evhtp_hooks {
482 
486  void * on_path_arg;
487  void * on_read_arg;
491  void * on_error_arg;
496  void * on_write_arg;
497  void * on_event_arg;
498 };
499 
500 #ifndef EVHTP_DISABLE_SSL
502  char * pemfile;
503  char * privfile;
504  char * cafile;
505  char * capath;
506  char * ciphers;
507  char * named_curve;
508  char * dhparams;
509  long ssl_opts;
524  void * args;
525 };
526 #endif
527 
528 
529 EVHTP_EXPORT void evhtp_set_mem_functions(void *(*malloc_)(size_t),
530  void *(*realloc_)(void *, size_t),
531  void (* free_)(void *));
532 
541 EVHTP_EXPORT evhtp_t * evhtp_new(struct event_base * evbase, void * arg);
542 
543 EVHTP_EXPORT void evhtp_enable_flag(evhtp_t *, int);
544 EVHTP_EXPORT void evhtp_connection_enable_flag(evhtp_connection_t *, int);
545 EVHTP_EXPORT void evhtp_request_enable_flag(evhtp_request_t *, int);
546 EVHTP_EXPORT int evhtp_get_flags(evhtp_t *);
547 EVHTP_EXPORT int evhtp_connection_get_flags(evhtp_connection_t *);
548 EVHTP_EXPORT int evhtp_request_get_flags(evhtp_request_t *);
549 EVHTP_EXPORT void evhtp_disable_flag(evhtp_t *, int);
550 EVHTP_EXPORT void evhtp_connection_disable_flag(evhtp_connection_t *, int);
551 EVHTP_EXPORT void evhtp_request_disable_flag(evhtp_request_t *, int);
552 
560 EVHTP_EXPORT void evhtp_free(evhtp_t * evhtp);
561 
571 EVHTP_EXPORT void evhtp_set_timeouts(evhtp_t * htp, const struct timeval * r, const struct timeval * w);
572 
573 
574 
588 EVHTP_EXPORT void evhtp_set_parser_flags(evhtp_t * htp, int flags);
589 
596 EVHTP_EXPORT void evhtp_set_bev_flags(evhtp_t * htp, int flags);
597 
598 #ifndef EVHTP_DISABLE_SSL
599 EVHTP_EXPORT int evhtp_ssl_use_threads(void);
600 EVHTP_EXPORT int evhtp_ssl_init(evhtp_t * htp, evhtp_ssl_cfg_t * ssl_cfg);
601 #endif
602 
603 
610 EVHTP_EXPORT void evhtp_disable_100_continue(evhtp_t * htp)
611 DEPRECATED("evhtp_disable_100 will soon be deprecated, use htp->flags instead");
612 
621 EVHTP_EXPORT int evhtp_use_callback_locks(evhtp_t * htp);
622 
630 EVHTP_EXPORT void evhtp_set_gencb(evhtp_t * htp, evhtp_callback_cb cb, void * arg);
631 
632 
642 EVHTP_EXPORT void evhtp_set_pre_accept_cb(evhtp_t * htp, evhtp_pre_accept_cb, void * arg);
643 
644 
654 EVHTP_EXPORT void evhtp_set_post_accept_cb(evhtp_t * htp, evhtp_post_accept_cb, void * arg);
655 
666 EVHTP_EXPORT evhtp_callback_t * evhtp_set_cb(evhtp_t * htp, const char * path,
667  evhtp_callback_cb cb, void * arg);
668 
669 
680 #ifndef EVHTP_DISABLE_REGEX
681 EVHTP_EXPORT evhtp_callback_t * evhtp_set_regex_cb(evhtp_t * htp, const char * pattern,
682  evhtp_callback_cb cb, void * arg);
683 #endif
684 
685 
686 
699 EVHTP_EXPORT evhtp_callback_t * evhtp_set_glob_cb(evhtp_t * htp, const char * pattern,
700  evhtp_callback_cb cb, void * arg);
701 
702 
728 EVHTP_EXPORT evhtp_callback_t * evhtp_get_cb(evhtp_t * htp, const char * needle);
729 
769 EVHTP_EXPORT int evhtp_connection_set_hook(evhtp_connection_t * c, evhtp_hook_type type, evhtp_hook cb, void * arg);
770 EVHTP_EXPORT int evhtp_request_set_hook(evhtp_request_t * r, evhtp_hook_type type, evhtp_hook cb, void * arg);
771 EVHTP_EXPORT int evhtp_callback_set_hook(evhtp_callback_t * cb, evhtp_hook_type type, evhtp_hook hookcb, void * arg);
772 
773 EVHTP_EXPORT evhtp_hooks_t * evhtp_connection_get_hooks(evhtp_connection_t * c);
774 EVHTP_EXPORT evhtp_hooks_t * evhtp_request_get_hooks(evhtp_request_t * r);
775 EVHTP_EXPORT evhtp_hooks_t * evhtp_callback_get_hooks(evhtp_callback_t * cb);
776 
784 EVHTP_EXPORT int evhtp_unset_all_hooks(evhtp_hooks_t ** hooks);
785 
786 EVHTP_EXPORT int evhtp_request_unset_hook(evhtp_request_t * req, evhtp_hook_type type);
787 EVHTP_EXPORT int evhtp_connection_unset_hook(evhtp_connection_t * conn, evhtp_hook_type type);
788 EVHTP_EXPORT int evhtp_callback_unset_hook(evhtp_callback_t * callback, evhtp_hook_type type);
789 
790 
806 EVHTP_EXPORT int evhtp_bind_socket(evhtp_t * htp, const char * addr, uint16_t port, int backlog);
807 
808 
814 EVHTP_EXPORT void evhtp_unbind_socket(evhtp_t * htp);
815 
816 
830 EVHTP_EXPORT int evhtp_accept_socket(evhtp_t * htp, evutil_socket_t sock, int backlog);
831 
843 EVHTP_EXPORT int evhtp_bind_sockaddr(evhtp_t * htp, struct sockaddr *,
844  size_t sin_len, int backlog);
845 
846 
861 EVHTP_EXPORT int evhtp_use_threads(evhtp_t *, evhtp_thread_init_cb, int nthreads, void *)
862 DEPRECATED("will take on the syntax of evhtp_use_threads_wexit");
863 
868 EVHTP_EXPORT int evhtp_use_threads_wexit(evhtp_t *,
871  int nthreads, void * arg);
872 
879 EVHTP_EXPORT void evhtp_send_reply(evhtp_request_t * request, evhtp_res code);
880 
881 
882 /* The following three functions allow for the user to do what evhtp_send_reply does at its core
883  * but for the weak of heart.
884  */
885 EVHTP_EXPORT void evhtp_send_reply_start(evhtp_request_t * request, evhtp_res code);
886 EVHTP_EXPORT void evhtp_send_reply_body(evhtp_request_t * request, struct evbuffer * buf);
887 EVHTP_EXPORT void evhtp_send_reply_end(evhtp_request_t * request);
888 
895 EVHTP_EXPORT int evhtp_response_needs_body(const evhtp_res code, const htp_method method);
896 
904 EVHTP_EXPORT void evhtp_send_reply_chunk_start(evhtp_request_t * request, evhtp_res code);
905 
906 
913 EVHTP_EXPORT void evhtp_send_reply_chunk(evhtp_request_t * request, struct evbuffer * buf);
914 
921 EVHTP_EXPORT void evhtp_send_reply_chunk_end(evhtp_request_t * request);
922 
942 EVHTP_EXPORT evhtp_callback_t *
943 evhtp_callback_new(const char * path, evhtp_callback_type type, evhtp_callback_cb cb, void * arg);
944 
954 EVHTP_EXPORT void evhtp_callback_free(evhtp_callback_t * callback);
955 
956 
965 EVHTP_EXPORT int evhtp_callbacks_add_callback(evhtp_callbacks_t * cbs, evhtp_callback_t * cb);
966 
967 
980 EVHTP_EXPORT int evhtp_add_vhost(evhtp_t * evhtp, const char * name, evhtp_t * vhost);
981 
982 
993 EVHTP_EXPORT int evhtp_add_alias(evhtp_t * evhtp, const char * name);
994 
995 
1007 EVHTP_EXPORT int evhtp_add_aliases(evhtp_t * evhtp, const char * name, ...);
1008 
1019 EVHTP_EXPORT evhtp_kv_t * evhtp_kv_new(const char * key, const char * val, char kalloc, char valloc);
1020 
1021 
1027 EVHTP_EXPORT evhtp_kvs_t * evhtp_kvs_new(void);
1028 
1029 
1035 EVHTP_EXPORT void evhtp_kv_free(evhtp_kv_t * kv);
1036 
1037 
1043 EVHTP_EXPORT void evhtp_kvs_free(evhtp_kvs_t * kvs);
1044 
1051 EVHTP_EXPORT void evhtp_kv_rm_and_free(evhtp_kvs_t * kvs, evhtp_kv_t * kv);
1052 
1061 EVHTP_EXPORT const char * evhtp_kv_find(evhtp_kvs_t * kvs, const char * key);
1062 
1063 
1072 EVHTP_EXPORT evhtp_kv_t * evhtp_kvs_find_kv(evhtp_kvs_t * kvs, const char * key);
1073 
1074 
1081 EVHTP_EXPORT void evhtp_kvs_add_kv(evhtp_kvs_t * kvs, evhtp_kv_t * kv);
1082 
1089 EVHTP_EXPORT void evhtp_kvs_add_kvs(evhtp_kvs_t * dst, evhtp_kvs_t * src);
1090 
1091 
1101 EVHTP_EXPORT int evhtp_kvs_for_each(evhtp_kvs_t * kvs, evhtp_kvs_iterator cb, void * arg);
1102 
1103 #define EVHTP_PARSE_QUERY_FLAG_STRICT 0
1104 #define EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX (1 << 0)
1105 #define EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS (1 << 1)
1106 #define EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS (1 << 2)
1107 #define EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP (1 << 3)
1108 #define EVHTP_PARSE_QUERY_FLAG_IGNORE_FRAGMENTS (1 << 4)
1109 #define EVHTP_PARSE_QUERY_FLAG_LENIENT \
1110  EVHTP_PARSE_QUERY_FLAG_IGNORE_HEX \
1111  | EVHTP_PARSE_QUERY_FLAG_ALLOW_EMPTY_VALS \
1112  | EVHTP_PARSE_QUERY_FLAG_ALLOW_NULL_VALS \
1113  | EVHTP_PARSE_QUERY_FLAG_TREAT_SEMICOLON_AS_SEP
1114 
1115 #define EVHTP_PARSE_QUERY_FLAG_DEFAULT EVHTP_PARSE_QUERY_FLAG_LENIENT
1116 
1128 EVHTP_EXPORT evhtp_query_t * evhtp_parse_query_wflags(const char * query, size_t len, int flags);
1129 
1141 EVHTP_EXPORT evhtp_query_t * evhtp_parse_query(const char * query, size_t len);
1142 
1152 EVHTP_EXPORT int evhtp_unescape_string(unsigned char ** out, unsigned char * str, size_t str_len);
1153 
1164 EVHTP_EXPORT evhtp_header_t * evhtp_header_new(const char * key, const char * val,
1165  char kalloc, char valloc);
1166 
1177 EVHTP_EXPORT evhtp_header_t * evhtp_header_key_add(evhtp_headers_t * headers,
1178  const char * key, char kalloc);
1179 
1180 
1190 EVHTP_EXPORT evhtp_header_t * evhtp_header_val_add(evhtp_headers_t * headers,
1191  const char * val, char valloc);
1192 
1193 
1200 EVHTP_EXPORT void evhtp_headers_add_header(evhtp_headers_t * headers, evhtp_header_t * header);
1201 
1210 EVHTP_EXPORT const char * evhtp_header_find(evhtp_headers_t * headers, const char * key);
1211 
1212 #define evhtp_headers_find_header evhtp_kvs_find_kv
1213 #define evhtp_headers_for_each evhtp_kvs_for_each
1214 #define evhtp_header_free evhtp_kv_free
1215 #define evhtp_headers_new evhtp_kvs_new
1216 #define evhtp_headers_free evhtp_kvs_free
1217 #define evhtp_header_rm_and_free evhtp_kv_rm_and_free
1218 #define evhtp_headers_add_headers evhtp_kvs_add_kvs
1219 #define evhtp_query_new evhtp_kvs_new
1220 #define evhtp_query_free evhtp_kvs_free
1221 
1222 
1230 EVHTP_EXPORT htp_method evhtp_request_get_method(evhtp_request_t * r);
1231 EVHTP_EXPORT evhtp_proto evhtp_request_get_proto(evhtp_request_t * r);
1232 
1233 
1241 EVHTP_EXPORT evhtp_res evhtp_request_get_status_code(evhtp_request_t * r);
1242 
1243 
1252 EVHTP_EXPORT const char * evhtp_request_get_status_code_str(evhtp_request_t * r);
1253 
1254 /* the following functions all do the same thing, pause and the processing */
1255 
1261 EVHTP_EXPORT void evhtp_connection_pause(evhtp_connection_t * connection);
1262 
1268 EVHTP_EXPORT void evhtp_connection_resume(evhtp_connection_t * connection);
1269 
1277 EVHTP_EXPORT void evhtp_request_pause(evhtp_request_t * request);
1278 
1286 EVHTP_EXPORT void evhtp_request_resume(evhtp_request_t * request);
1287 
1288 
1296 EVHTP_EXPORT evhtp_connection_t * evhtp_request_get_connection(evhtp_request_t * request);
1297 
1304 EVHTP_EXPORT void evhtp_connection_set_bev(evhtp_connection_t * conn, struct bufferevent * bev);
1305 
1312 EVHTP_EXPORT void evhtp_request_set_bev(evhtp_request_t * request, struct bufferevent * bev);
1313 
1314 
1322 EVHTP_EXPORT struct bufferevent * evhtp_connection_get_bev(evhtp_connection_t * conn);
1323 
1332 EVHTP_EXPORT void
1333 evhtp_connection_set_timeouts(evhtp_connection_t * conn,
1334  const struct timeval * r,
1335  const struct timeval * w);
1336 
1344 EVHTP_EXPORT struct bufferevent * evhtp_request_get_bev(evhtp_request_t * request);
1345 
1346 
1359 EVHTP_EXPORT struct bufferevent * evhtp_connection_take_ownership(evhtp_connection_t * connection);
1360 
1361 
1368 EVHTP_EXPORT void evhtp_connection_free(evhtp_connection_t * connection);
1369 EVHTP_EXPORT void evhtp_request_free(evhtp_request_t * request);
1370 
1378 EVHTP_EXPORT void evhtp_set_max_body_size(evhtp_t * htp, uint64_t len);
1379 
1387 EVHTP_EXPORT void evhtp_connection_set_max_body_size(evhtp_connection_t * conn, uint64_t len);
1388 
1395 EVHTP_EXPORT void evhtp_request_set_max_body_size(evhtp_request_t * request, uint64_t len);
1396 EVHTP_EXPORT void evhtp_request_set_keepalive(evhtp_request_t * request, int val);
1397 
1404 EVHTP_EXPORT void evhtp_set_max_keepalive_requests(evhtp_t * htp, uint64_t num);
1405 
1406 
1407 /*****************************************************************
1408 * client request functions *
1409 *****************************************************************/
1410 
1414 EVHTP_EXPORT evhtp_connection_t * evhtp_connection_new_dns(
1415  struct event_base * evbase,
1416  struct evdns_base * dns_base,
1417  const char * addr, uint16_t port);
1418 
1422 EVHTP_EXPORT evhtp_connection_t *
1423 evhtp_connection_new(struct event_base * evbase, const char * addr, uint16_t port);
1424 
1425 #ifndef EVHTP_DISABLE_SSL
1426 EVHTP_EXPORT evhtp_connection_t * evhtp_connection_ssl_new(
1427  struct event_base * evbase,
1428  const char * addr, uint16_t port, evhtp_ssl_ctx_t * ctx);
1429 #endif
1430 
1431 
1435 EVHTP_EXPORT evhtp_request_t * evhtp_request_new(evhtp_callback_cb cb, void * arg);
1436 
1440 EVHTP_EXPORT int evhtp_make_request(evhtp_connection_t * c,
1441  evhtp_request_t * r, htp_method meth, const char * uri);
1442 
1443 EVHTP_EXPORT unsigned int evhtp_request_status(evhtp_request_t *);
1445 #define evhtp_safe_free(_var, _freefn) do { \
1446  _freefn((_var)); \
1447  (_var) = NULL; \
1448 } while (0)
1449 
1450 
1451 #ifdef __cplusplus
1452 }
1453 #endif
1454 
1455 #endif /* __EVHTP__H__ */
evhtp::server
struct evconnlistener * server
the libevent listener struct
Definition: evhtp/evhtp.h:286
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.
Definition: evhtp.c:5060
evhtp_proto
evhtp_proto
Definition: evhtp/evhtp.h:135
evhtp_hooks::on_connection_error_arg
void * on_connection_error_arg
Definition: evhtp/evhtp.h:490
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.
Definition: evhtp.c:4283
evhtp_use_threads
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.
Definition: evhtp.c:4594
evhtp_request::htp
evhtp_t * htp
the parent evhtp_t structure
Definition: evhtp/evhtp.h:402
evhtp_res
uint16_t evhtp_res
Definition: evhtp/evhtp.h:90
evhtp_hook_on_write
Definition: evhtp/evhtp.h:121
evhtp_connection::num_requests
uint64_t num_requests
Definition: evhtp/evhtp.h:447
evhtp_kvs_iterator
int(* evhtp_kvs_iterator)(evhtp_kv_t *kv, void *arg)
Definition: evhtp/evhtp.h:177
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.
Definition: evhtp.c:3913
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.
Definition: evhtp.c:3745
htparser
Definition: parser.c:91
evhtp_hook_type
evhtp_hook_type
types associated with where a developer can hook into during the request processing cycle.
Definition: evhtp/evhtp.h:108
evhtp_thread_exit_cb
void(* evhtp_thread_exit_cb)(evhtp_t *htp, evthr_t *thr, void *arg)
Definition: evhtp/evhtp.h:153
evhtp_request_get_flags
EVHTP_EXPORT int evhtp_request_get_flags(evhtp_request_t *)
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'
Definition: evhtp.c:3273
evhtp_kvs_t
struct evhtp_kvs evhtp_kvs_t
Definition: evhtp/evhtp.h:81
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
Definition: evhtp.c:4705
evhtp_uri::query_raw
unsigned char * query_raw
the unparsed query arguments
Definition: evhtp/evhtp.h:363
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.
Definition: evhtp.c:3486
evhtp_set_pre_accept_cb
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.
Definition: evhtp.c:4712
evhtp_hook
evhtp_res(* evhtp_hook)()
Definition: evhtp/evhtp.h:159
evhtp_callback
structure containing a single callback and configuration
Definition: evhtp.c:51
evhtp_authority::password
char * password
the password in URI (scheme://...:PASS.
Definition: evhtp/evhtp.h:374
evhtp_hooks::on_error_arg
void * on_error_arg
Definition: evhtp/evhtp.h:491
evhtp_hook_headers_start_cb
evhtp_res(* evhtp_hook_headers_start_cb)(evhtp_request_t *r, void *arg)
Definition: evhtp/evhtp.h:173
evhtp_alias
Definition: evhtp/evhtp.h:273
evhtp_path::matched_soff
unsigned int matched_soff
offset of where the uri starts mainly used for regex matching
Definition: evhtp/evhtp.h:389
evhtp::TAILQ_ENTRY
TAILQ_ENTRY(evhtp) next_vhost
evhtp_hooks::on_write
evhtp_hook_write_cb on_write
Definition: evhtp/evhtp.h:480
evhtp_disable_100_continue
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 HTT...
evhtp_connection_get_hooks
EVHTP_EXPORT evhtp_hooks_t * evhtp_connection_get_hooks(evhtp_connection_t *c)
Definition: evhtp.c:4451
evhtp::TAILQ_HEAD
TAILQ_HEAD(, evhtp_alias) aliases
evhtp_hook_on_chunk_complete
Definition: evhtp/evhtp.h:116
evhtp::max_body_size
uint64_t max_body_size
Definition: evhtp/evhtp.h:290
evhtp_x509_store_ctx_t
X509_STORE_CTX evhtp_x509_store_ctx_t
Definition: evhtp/evhtp.h:48
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...
Definition: evhtp.c:4670
evhtp_hook_on_hostname
Definition: evhtp/evhtp.h:120
evhtp_connection::max_body_size
uint64_t max_body_size
Definition: evhtp/evhtp.h:445
evhtp_connection::evbase
struct event_base * evbase
Definition: evhtp/evhtp.h:429
evhtp_callback_get_hooks
EVHTP_EXPORT evhtp_hooks_t * evhtp_callback_get_hooks(evhtp_callback_t *cb)
returns callback hooks
Definition: evhtp.c:4483
evhtp_callback_cb
void(* evhtp_callback_cb)(evhtp_request_t *req, void *arg)
Definition: evhtp/evhtp.h:154
evhtp_disable_flag
EVHTP_EXPORT void evhtp_disable_flag(evhtp_t *, int)
evhtp_defaults::pre_accept_cbarg
void * pre_accept_cbarg
Definition: evhtp/evhtp.h:269
evhtp::flags
uint16_t flags
the base flags set for this context, see: EVHTP_FLAG_*
Definition: evhtp/evhtp.h:303
evhtp_hooks::on_hostname
evhtp_hook_hostname_cb on_hostname
Definition: evhtp/evhtp.h:479
evhtp_ssl_cfg::dhparams
char * dhparams
Definition: evhtp/evhtp.h:508
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
Definition: evhtp.c:3106
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: evhtp.c:5454
evhtp_request_disable_flag
EVHTP_EXPORT void evhtp_request_disable_flag(evhtp_request_t *, int)
evhtp_error_flags
uint8_t evhtp_error_flags
Definition: evhtp/evhtp.h:91
evhtp_connection_unset_hook
EVHTP_EXPORT int evhtp_connection_unset_hook(evhtp_connection_t *conn, evhtp_hook_type type)
Definition: evhtp.c:4386
evhtp_ssl_scache_type_user
Definition: evhtp/evhtp.h:100
evhtp_kv::klen
size_t klen
Definition: evhtp/evhtp.h:343
evhtp_request_get_hooks
EVHTP_EXPORT evhtp_hooks_t * evhtp_request_get_hooks(evhtp_request_t *r)
returns request hooks
Definition: evhtp.c:4467
evhtp_ssl_cfg::decrypt_cb
evhtp_ssl_decrypt_cb decrypt_cb
Definition: evhtp/evhtp.h:515
evhtp_uri::path
evhtp_path_t * path
Definition: evhtp/evhtp.h:361
evhtp_request::cbarg
void * cbarg
argument which is passed to the cb function
Definition: evhtp/evhtp.h:420
evhtp_hooks::on_event_arg
void * on_event_arg
Definition: evhtp/evhtp.h:497
evhtp_hook_headers_cb
evhtp_res(* evhtp_hook_headers_cb)(evhtp_request_t *req, evhtp_headers_t *hdr, void *arg)
Definition: evhtp/evhtp.h:165
evhtp_send_reply_start
EVHTP_EXPORT void evhtp_send_reply_start(evhtp_request_t *request, evhtp_res code)
Definition: evhtp.c:3752
evhtp_connection_set_timeouts
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.
Definition: evhtp.c:5038
EVHTP_PROTO_INVALID
Definition: evhtp/evhtp.h:136
evhtp_hooks::on_headers_start
evhtp_hook_headers_start_cb on_headers_start
Definition: evhtp/evhtp.h:467
evhtp_ssl_cfg::cafile
char * cafile
Definition: evhtp/evhtp.h:504
evbev_t
struct bufferevent evbev_t
Definition: evhtp/evhtp.h:65
evhtp_kv::val
char * val
Definition: evhtp/evhtp.h:341
EVHTP_PROTO_10
Definition: evhtp/evhtp.h:137
evhtp_ssl_decrypt_cb
EVP_PKEY *(* evhtp_ssl_decrypt_cb)(char *privfile)
Definition: evhtp/evhtp.h:183
evhtp_callback_type_glob
Definition: evhtp/evhtp.h:129
free_
static void(* free_)(void *d)
Definition: evhtp.c:168
evhtp_hooks::on_chunks_fini
evhtp_hook_chunks_fini_cb on_chunks_fini
Definition: evhtp/evhtp.h:478
evhtp_ssl_use_threads
EVHTP_EXPORT int evhtp_ssl_use_threads(void)
Definition: evhtp.c:4728
evhtp_hooks::on_chunks_fini_arg
void * on_chunks_fini_arg
Definition: evhtp/evhtp.h:494
event_t
struct event event_t
Definition: evhtp/evhtp.h:63
evhtp_hooks::on_headers_arg
void * on_headers_arg
Definition: evhtp/evhtp.h:485
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.
Definition: evhtp.c:4114
evhtp_uri
a generic container representing an entire URI strucutre
Definition: evhtp/evhtp.h:359
evhtp_hooks::on_header
evhtp_hook_header_cb on_header
Definition: evhtp/evhtp.h:468
evhtp_ssl_verify_cb
int(* evhtp_ssl_verify_cb)(int pre_verify, evhtp_x509_store_ctx_t *ctx)
Definition: evhtp/evhtp.h:181
evhtp_connection_get_flags
EVHTP_EXPORT int evhtp_connection_get_flags(evhtp_connection_t *)
evhtp_ssl_scache_type_disabled
Definition: evhtp/evhtp.h:98
evhtp_hook_chunks_fini_cb
evhtp_res(* evhtp_hook_chunks_fini_cb)(evhtp_request_t *r, void *arg)
Definition: evhtp/evhtp.h:172
evhtp_ssl_cfg::scache_get
evhtp_ssl_scache_get scache_get
Definition: evhtp/evhtp.h:522
evhtp_ssl_cfg::ciphers
char * ciphers
Definition: evhtp/evhtp.h:506
evhtp_thread_init_cb
void(* evhtp_thread_init_cb)(evhtp_t *htp, evthr_t *thr, void *arg)
Definition: evhtp/evhtp.h:152
evhtp_headers_iterator
#define evhtp_headers_iterator
Definition: evhtp/evhtp.h:197
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.
Definition: evhtp.c:5125
evhtp::ssl_cfg
evhtp_ssl_cfg_t * ssl_cfg
Definition: evhtp/evhtp.h:308
evhtp_type_server
Definition: evhtp/evhtp.h:143
evhtp::thread_cbarg
void * thread_cbarg
Definition: evhtp/evhtp.h:322
cb
evthr_cb cb
Definition: thread.c:124
evhtp_uri::fragment
unsigned char * fragment
data after '#' in uri
Definition: evhtp/evhtp.h:362
evhtp_connection::saddr
struct sockaddr * saddr
Definition: evhtp/evhtp.h:440
evhtp_ssl_cfg::ssl_opts
long ssl_opts
Definition: evhtp/evhtp.h:509
evhtp_callbacks_t
struct evhtp_callbacks evhtp_callbacks_t
Definition: evhtp/evhtp.h:78
evhtp::thread_exit_cb
evhtp_thread_exit_cb thread_exit_cb
Definition: evhtp/evhtp.h:316
evhtp_uri::query
evhtp_query_t * query
list of k/v for query arguments
Definition: evhtp/evhtp.h:364
evhtp_header_find
const EVHTP_EXPORT char * evhtp_header_find(evhtp_headers_t *headers, const char *key)
finds the value of a key in a evhtp_headers_t structure
Definition: evhtp.c:3311
evhtp_request::flags
uint16_t flags
Definition: evhtp/evhtp.h:417
evhtp_kv::key
char * key
Definition: evhtp/evhtp.h:340
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
Definition: evhtp.c:4489
evhtp_send_reply_chunk_start
EVHTP_EXPORT void evhtp_send_reply_chunk_start(evhtp_request_t *request, evhtp_res code)
start a chunked response.
Definition: evhtp.c:3820
evhtp_hooks::on_event
evhtp_hook_event_cb on_event
Definition: evhtp/evhtp.h:481
evhtp_ssl_data_t
unsigned char evhtp_ssl_data_t
Definition: evhtp/evhtp.h:50
evhtp_path
structure which represents a URI path and or file
Definition: evhtp/evhtp.h:383
evhtp_connection::type
evhtp_type type
server or client
Definition: evhtp/evhtp.h:448
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.
Definition: evhtp.c:5232
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: evhtp.c:5383
evhtp_hook_on_path
type which defines to hook once a path has been parsed
Definition: evhtp/evhtp.h:111
evhtp_callback_type_hash
Definition: evhtp/evhtp.h:128
evhtp_request_pause
EVHTP_EXPORT void evhtp_request_pause(evhtp_request_t *request)
Wrapper around evhtp_connection_pause.
Definition: evhtp.c:3075
evhtp_path::file
char * file
the filename if present (c.html)
Definition: evhtp/evhtp.h:386
evhtp_hook_on_chunks_complete
Definition: evhtp/evhtp.h:117
evhtp_use_threads_wexit
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.
Definition: evhtp.c:4601
evhtp_request::headers_in
evhtp_headers_t * headers_in
headers from client
Definition: evhtp/evhtp.h:408
evhtp_connection
Definition: evhtp/evhtp.h:427
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.
Definition: evhtp.c:5149
evhtp_hooks::on_chunk_fini
evhtp_hook_chunk_fini_cb on_chunk_fini
Definition: evhtp/evhtp.h:477
evhtp_enable_flag
EVHTP_EXPORT void evhtp_enable_flag(evhtp_t *, int)
evhtp_hook_write_cb
evhtp_res(* evhtp_hook_write_cb)(evhtp_connection_t *conn, void *arg)
Definition: evhtp/evhtp.h:175
evhtp_ssl_cfg::ssl_ctx_timeout
long ssl_ctx_timeout
Definition: evhtp/evhtp.h:510
evhtp_connection::request
evhtp_request_t * request
the request currently being processed
Definition: evhtp/evhtp.h:444
evhtp_kv::TAILQ_ENTRY
TAILQ_ENTRY(evhtp_kv) next
evhtp_hook_on_read
type which defines to hook whenever the parser recieves data in a body
Definition: evhtp/evhtp.h:112
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: evhtp.c:4399
evserv_t
struct evconnlistener evserv_t
Definition: evhtp/evhtp.h:64
evhtp_post_accept_cb
evhtp_res(* evhtp_post_accept_cb)(evhtp_connection_t *conn, void *arg)
Definition: evhtp/evhtp.h:163
evhtp_ssl_cfg
Definition: evhtp/evhtp.h:501
evhtp_ssl_cfg::capath
char * capath
Definition: evhtp/evhtp.h:505
evhtp_connection::scratch_buf
struct evbuffer * scratch_buf
always zero'd out after used
Definition: evhtp/evhtp.h:459
evhtp_connection::bev
struct bufferevent * bev
Definition: evhtp/evhtp.h:430
evhtp_kv_free
EVHTP_EXPORT void evhtp_kv_free(evhtp_kv_t *kv)
frees resources allocated for a single key/value
Definition: evhtp.c:3219
evhtp_type
evhtp_type
Definition: evhtp/evhtp.h:141
evhtp_ssl_init
EVHTP_EXPORT int evhtp_ssl_init(evhtp_t *htp, evhtp_ssl_cfg_t *ssl_cfg)
Definition: evhtp.c:4762
evhtp_request
a structure containing all information for a http request.
Definition: evhtp/evhtp.h:401
evhtp_ssl_t
SSL evhtp_ssl_t
Definition: evhtp/evhtp.h:45
evhtp_authority
structure which represents authority information in a URI
Definition: evhtp/evhtp.h:372
evhtp_ssl_cfg::privfile
char * privfile
Definition: evhtp/evhtp.h:503
evhtp_authority::username
char * username
the username in URI (scheme://USER:.
Definition: evhtp/evhtp.h:373
evhtp_hooks::on_path
evhtp_hook_path_cb on_path
Definition: evhtp/evhtp.h:470
evhtp_ssl_cfg::scache_add
evhtp_ssl_scache_add scache_add
Definition: evhtp/evhtp.h:521
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.
Definition: evhtp.c:5137
evhtp_bind_sockaddr
EVHTP_EXPORT int evhtp_bind_sockaddr(evhtp_t *htp, struct sockaddr *, size_t sin_len, int backlog)
bind to an already allocated sockaddr.
Definition: evhtp.c:4047
evbuf_t
struct evbuffer evbuf_t
Definition: evhtp/evhtp.h:62
evhtp_connection_get_bev
EVHTP_EXPORT struct bufferevent * evhtp_connection_get_bev(evhtp_connection_t *conn)
returns the underlying connections bufferevent
Definition: evhtp.c:4950
evhtp::thr_pool
evthr_pool_t * thr_pool
connection threadpool
Definition: evhtp/evhtp.h:312
evhtp_hook_event_cb
void(* evhtp_hook_event_cb)(evhtp_connection_t *conn, short events, void *arg)
Definition: evhtp/evhtp.h:156
evhtp_kvs_free
EVHTP_EXPORT void evhtp_kvs_free(evhtp_kvs_t *kvs)
frees a the list of key/values, and all underlying entries
Definition: evhtp.c:3249
evhtp_request_free
EVHTP_EXPORT void evhtp_request_free(evhtp_request_t *request)
Definition: evhtp.c:5103
evhtp_request_set_keepalive
EVHTP_EXPORT void evhtp_request_set_keepalive(evhtp_request_t *request, int val)
Definition: evhtp.c:5006
evhtp_ssl_cfg::verify_peer
int verify_peer
Definition: evhtp/evhtp.h:511
evhtp_kv_find
const EVHTP_EXPORT char * evhtp_kv_find(evhtp_kvs_t *kvs, const char *key)
find the string value of 'key' from the key/value list 'kvs'
Definition: evhtp.c:3293
evhtp_send_reply_end
EVHTP_EXPORT void evhtp_send_reply_end(evhtp_request_t *request)
Definition: evhtp.c:3779
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 ho...
Definition: evhtp.c:4613
evhtp_ssl_scache_add
int(* evhtp_ssl_scache_add)(evhtp_connection_t *connection, evhtp_ssl_data_t *sid, int sid_len, evhtp_ssl_sess_t *sess)
Definition: evhtp/evhtp.h:185
evhtp_request::buffer_in
struct evbuffer * buffer_in
buffer containing data from client
Definition: evhtp/evhtp.h:406
evhtp_defaults
Definition: evhtp/evhtp.h:264
evhtp_connection_disable_flag
EVHTP_EXPORT void evhtp_connection_disable_flag(evhtp_connection_t *, int)
evhtp_kv::v_heaped
char v_heaped
set to 1 if the val can be free()'d
Definition: evhtp/evhtp.h:347
evhtp_connection::send_timeo
struct timeval send_timeo
conn write timeouts (overrides global)
Definition: evhtp/evhtp.h:442
evhtp_connection::thread
evthr_t * thread
Definition: evhtp/evhtp.h:432
evhtp_hooks::on_write_arg
void * on_write_arg
Definition: evhtp/evhtp.h:496
evhtp_kv::k_heaped
char k_heaped
set to 1 if the key can be free()'d
Definition: evhtp/evhtp.h:346
realloc_
static void *(* realloc_)(void *d, size_t sz)
Definition: evhtp.c:167
evhtp_path::path
char * path
the path (/a/b/)
Definition: evhtp/evhtp.h:385
evhtp_connection_enable_flag
EVHTP_EXPORT void evhtp_connection_enable_flag(evhtp_connection_t *, int)
evhtp_hook_chunk_new_cb
evhtp_res(* evhtp_hook_chunk_new_cb)(evhtp_request_t *r, uint64_t len, void *arg)
Definition: evhtp/evhtp.h:170
evhtp_connection::hooks
evhtp_hooks_t * hooks
Definition: evhtp/evhtp.h:437
evhtp_hook_on_request_fini
type which defines to hook before the request is free'd
Definition: evhtp/evhtp.h:113
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'
Definition: evhtp.c:3329
evhtp_defaults::cb
evhtp_callback_cb cb
Definition: evhtp/evhtp.h:265
instead
EVHTP_EXPORT void use htp flags instead
Definition: evhtp/evhtp.h:611
evhtp_ssl_scache_init
void *(* evhtp_ssl_scache_init)(evhtp_t *)
Definition: evhtp/evhtp.h:189
evhtp::thread_init_cb
evhtp_thread_init_cb thread_init_cb
Definition: evhtp/evhtp.h:315
evhtp_hooks::on_read_arg
void * on_read_arg
Definition: evhtp/evhtp.h:487
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
Definition: evhtp.c:3357
evhtp_connection::recv_timeo
struct timeval recv_timeo
conn read timeouts (overrides global)
Definition: evhtp/evhtp.h:441
evhtp_authority::hostname
char * hostname
hostname if present in URI
Definition: evhtp/evhtp.h:375
evhtp::max_keepalive_requests
uint64_t max_keepalive_requests
Definition: evhtp/evhtp.h:291
evhtp_ssl_cfg::store_flags
long store_flags
Definition: evhtp/evhtp.h:516
evhtp_ssl_cfg::verify_depth
int verify_depth
Definition: evhtp/evhtp.h:512
evhtp_mutex_t
pthread_mutex_t evhtp_mutex_t
Definition: evhtp/evhtp.h:73
evhtp::send_timeo
struct timeval send_timeo
Definition: evhtp/evhtp.h:328
evhtp_ssl_cfg::named_curve
char * named_curve
Definition: evhtp/evhtp.h:507
evhtp_connection::ssl
evhtp_ssl_t * ssl
Definition: evhtp/evhtp.h:435
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.
Definition: evhtp.c:4186
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: evhtp.c:4392
evhtp_hooks::on_path_arg
void * on_path_arg
Definition: evhtp/evhtp.h:486
evhtp_defaults::post_accept_cbarg
void * post_accept_cbarg
Definition: evhtp/evhtp.h:270
TAILQ_HEAD
TAILQ_HEAD(evhtp_kvs, evhtp_kv)
evhtp_hook_read_cb
evhtp_res(* evhtp_hook_read_cb)(evhtp_request_t *req, struct evbuffer *buf, void *arg)
Definition: evhtp/evhtp.h:167
evhtp_headers_t
struct evhtp_kvs evhtp_headers_t
Definition: evhtp/evhtp.h:94
evhtp_connection_resume
EVHTP_EXPORT void evhtp_connection_resume(evhtp_connection_t *connection)
resumes a connection (enables reading) and activates resume event.
Definition: evhtp.c:3056
evhtp_get_flags
EVHTP_EXPORT int evhtp_get_flags(evhtp_t *)
evhtp_hook_conn_err_cb
evhtp_res(* evhtp_hook_conn_err_cb)(evhtp_connection_t *connection, evhtp_error_flags errtype, void *arg)
Definition: evhtp/evhtp.h:161
evhtp_callback_free
EVHTP_EXPORT void evhtp_callback_free(evhtp_callback_t *callback)
safely frees callback structure memory and internals
Definition: evhtp.c:4253
evhtp_hook_on_event
Definition: evhtp/evhtp.h:122
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: evhtp.c:5377
evhtp_ssl_cfg::x509_chk_issued_cb
evhtp_ssl_chk_issued_cb x509_chk_issued_cb
Definition: evhtp/evhtp.h:514
evhtp_connection::htp
evhtp_t * htp
Definition: evhtp/evhtp.h:428
evhtp_new
EVHTP_EXPORT evhtp_t * evhtp_new(struct event_base *evbase, void *arg)
creates a new evhtp_t instance
Definition: evhtp.c:5318
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.
Definition: evhtp.c:5177
evhtp_query_t
struct evhtp_kvs evhtp_query_t
Definition: evhtp/evhtp.h:95
EVHTP_PROTO_11
Definition: evhtp/evhtp.h:138
evhtp_hooks::on_new_chunk
evhtp_hook_chunk_new_cb on_new_chunk
Definition: evhtp/evhtp.h:476
evhtp_free
EVHTP_EXPORT void evhtp_free(evhtp_t *evhtp)
Frees evhtp_t structure; will stop and free threads associated with the structure,...
Definition: evhtp.c:5330
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.
Definition: evhtp.c:3997
evhtp_hooks::on_read
evhtp_hook_read_cb on_read
Definition: evhtp/evhtp.h:471
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
Definition: evhtp.c:5000
evhtp_request_enable_flag
EVHTP_EXPORT void evhtp_request_enable_flag(evhtp_request_t *, int)
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'.
Definition: evhtp.c:4524
evhtp_request_resume
EVHTP_EXPORT void evhtp_request_resume(evhtp_request_t *request)
Wrapper around evhtp_connection_resume.
Definition: evhtp.c:3084
evhtp_hook_on_conn_error
type which defines to hook whenever a connection error occurs
Definition: evhtp/evhtp.h:123
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
Definition: evhtp.c:3092
evhtp_ssl_scache_get
evhtp_ssl_sess_t *(* evhtp_ssl_scache_get)(evhtp_connection_t *connection, evhtp_ssl_data_t *sid, int sid_len)
Definition: evhtp/evhtp.h:187
evhtp_request::uri
evhtp_uri_t * uri
request URI information
Definition: evhtp/evhtp.h:405
evhtp_hook_err_cb
void(* evhtp_hook_err_cb)(evhtp_request_t *req, evhtp_error_flags errtype, void *arg)
Definition: evhtp/evhtp.h:155
evhtp_hooks
Definition: evhtp/evhtp.h:466
evhtp_connection::sock
evutil_socket_t sock
Definition: evhtp/evhtp.h:443
evhtp_unset_all_hooks
EVHTP_EXPORT int evhtp_unset_all_hooks(evhtp_hooks_t **hooks)
removes all hooks.
Definition: evhtp.c:4412
evhtp_type_client
Definition: evhtp/evhtp.h:142
evhtp_callback_type_regex
Definition: evhtp/evhtp.h:131
evhtp_defaults::post_accept
evhtp_post_accept_cb post_accept
Definition: evhtp/evhtp.h:267
evhtp::lock
pthread_mutex_t * lock
parent lock for add/del cbs in threads
Definition: evhtp/evhtp.h:313
evhtp_request_status
EVHTP_EXPORT unsigned int evhtp_request_status(evhtp_request_t *)
Definition: evhtp.c:5588
evhtp_uri::scheme
htp_scheme scheme
set if a scheme is found
Definition: evhtp/evhtp.h:365
evhtp_callback_unset_hook
EVHTP_EXPORT int evhtp_callback_unset_hook(evhtp_callback_t *callback, evhtp_hook_type type)
Definition: evhtp.c:4374
evhtp_request_get_status_code_str
const EVHTP_EXPORT 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 requ...
Definition: evhtp.c:5032
evhtp_send_reply_chunk
EVHTP_EXPORT void evhtp_send_reply_chunk(evhtp_request_t *request, struct evbuffer *buf)
send a chunk reply.
Definition: evhtp.c:3888
evhtp_kv::vlen
size_t vlen
Definition: evhtp/evhtp.h:344
evhtp_hook_request_fini_cb
evhtp_res(* evhtp_hook_request_fini_cb)(evhtp_request_t *req, void *arg)
Definition: evhtp/evhtp.h:168
evhtp_hook_on_headers_start
Definition: evhtp/evhtp.h:118
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
Definition: evhtp.c:5205
evhtp::arg
void * arg
user-defined evhtp_t specific arguments
Definition: evhtp/evhtp.h:288
evhtp_connection::resume_ev
struct event * resume_ev
Definition: evhtp/evhtp.h:439
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 ...
Definition: evhtp.c:5066
evhtp_set_post_accept_cb
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.
Definition: evhtp.c:4719
evhtp_hook_on_error
type which defines to hook whenever an error occurs
Definition: evhtp/evhtp.h:119
evhtp_hooks::on_header_arg
void * on_header_arg
Definition: evhtp/evhtp.h:484
evhtp_send_reply_body
EVHTP_EXPORT void evhtp_send_reply_body(evhtp_request_t *request, struct evbuffer *buf)
Definition: evhtp.c:3769
evhtp_request_get_bev
EVHTP_EXPORT struct bufferevent * evhtp_request_get_bev(evhtp_request_t *request)
returns the underlying requests bufferevent
Definition: evhtp.c:4982
evhtp_ssl_scache_type
evhtp_ssl_scache_type
Definition: evhtp/evhtp.h:97
evhtp_request::hooks
evhtp_hooks_t * hooks
request specific hooks
Definition: evhtp/evhtp.h:404
evhtp
main structure containing all configuration information
Definition: evhtp/evhtp.h:283
malloc_
static void *(* malloc_)(size_t sz)
Definition: evhtp.c:166
evhtp_request::method
htp_method method
HTTP method used.
Definition: evhtp/evhtp.h:411
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.
Definition: evhtp.c:3811
evhtp_connection_set_bev
EVHTP_EXPORT void evhtp_connection_set_bev(evhtp_connection_t *conn, struct bufferevent *bev)
Sets the connections underlying bufferevent.
Definition: evhtp.c:4994
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}'.
Definition: evhtp.c:3413
evhtp_hooks::on_headers_start_arg
void * on_headers_start_arg
Definition: evhtp/evhtp.h:483
evhtp_request::proto
evhtp_proto proto
HTTP protocol used.
Definition: evhtp/evhtp.h:410
evhtp_kvs_new
EVHTP_EXPORT evhtp_kvs_t * evhtp_kvs_new(void)
creates an empty list of key/values
Definition: evhtp.c:3140
evhtp_request::headers_out
evhtp_headers_t * headers_out
headers to client
Definition: evhtp/evhtp.h:409
evhtp_request_get_proto
EVHTP_EXPORT evhtp_proto evhtp_request_get_proto(evhtp_request_t *r)
Definition: evhtp.c:5020
evhtp_uri::authority
evhtp_authority_t * authority
Definition: evhtp/evhtp.h:360
evhtp_hooks::on_connection_fini_arg
void * on_connection_fini_arg
Definition: evhtp/evhtp.h:489
evhtp_hook_header_cb
evhtp_res(* evhtp_hook_header_cb)(evhtp_request_t *req, evhtp_header_t *hdr, void *arg)
Definition: evhtp/evhtp.h:164
evhtp_hook_chunk_fini_cb
evhtp_res(* evhtp_hook_chunk_fini_cb)(evhtp_request_t *r, void *arg)
Definition: evhtp/evhtp.h:171
evhtp_ssl_chk_issued_cb
int(* evhtp_ssl_chk_issued_cb)(evhtp_x509_store_ctx_t *ctx, evhtp_x509_t *x, evhtp_x509_t *issuer)
Definition: evhtp/evhtp.h:182
evhtp_alias::alias
char * alias
Definition: evhtp/evhtp.h:274
evhtp_request::conn
evhtp_connection_t * conn
the associated connection
Definition: evhtp/evhtp.h:403
evhtp_ssl_cfg::scache_timeout
long scache_timeout
Definition: evhtp/evhtp.h:518
evhtp_request_new
EVHTP_EXPORT evhtp_request_t * evhtp_request_new(evhtp_callback_cb cb, void *arg)
allocate a new request
Definition: evhtp.c:5525
evhtp_request_unset_hook
EVHTP_EXPORT int evhtp_request_unset_hook(evhtp_request_t *req, evhtp_hook_type type)
Definition: evhtp.c:4380
evhtp::server_name
char * server_name
the name included in Host: responses
Definition: evhtp/evhtp.h:287
evhtp_ssl_cfg::scache_type
evhtp_ssl_scache_type scache_type
Definition: evhtp/evhtp.h:517
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.
Definition: evhtp.c:5113
evhtp_hook_connection_fini_cb
evhtp_res(* evhtp_hook_connection_fini_cb)(evhtp_connection_t *connection, void *arg)
Definition: evhtp/evhtp.h:169
evhtp_ssl_scache_type_internal
Definition: evhtp/evhtp.h:99
evhtp_hook_on_connection_fini
Definition: evhtp/evhtp.h:114
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.
Definition: evhtp.c:3024
evhtp_hook_hostname_cb
evhtp_res(* evhtp_hook_hostname_cb)(evhtp_request_t *r, const char *hostname, void *arg)
Definition: evhtp/evhtp.h:174
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
Definition: evhtp.c:3317
evhtp_request::buffer_out
struct evbuffer * buffer_out
buffer containing data to client
Definition: evhtp/evhtp.h:407
evhtp_request::status
evhtp_res status
The HTTP response code or other error conditions.
Definition: evhtp/evhtp.h:412
evhtp::parser_flags
uint16_t parser_flags
default query flags to alter 'strictness' (see EVHTP_PARSE_QUERY_FLAG_*)
Definition: evhtp/evhtp.h:304
evhtp_hook_on_header
type which defines to hook after one header has been parsed
Definition: evhtp/evhtp.h:109
evhtp_hooks::on_chunk_fini_arg
void * on_chunk_fini_arg
Definition: evhtp/evhtp.h:493
evhtp_hooks::on_connection_error
evhtp_hook_conn_err_cb on_connection_error
Definition: evhtp/evhtp.h:474
evhtp::recv_timeo
struct timeval recv_timeo
Definition: evhtp/evhtp.h:327
evhtp_hooks::on_headers
evhtp_hook_headers_cb on_headers
Definition: evhtp/evhtp.h:469
evhtp_ssl_scache_del
void(* evhtp_ssl_scache_del)(evhtp_t *htp, evhtp_ssl_data_t *sid, int sid_len)
Definition: evhtp/evhtp.h:186
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
Definition: evhtp.c:3785
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
Definition: evhtp.c:4630
evhtp_request::TAILQ_ENTRY
TAILQ_ENTRY(evhtp_request) next
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.
Definition: evhtp.c:3156
evhtp_path::match_end
char * match_end
Definition: evhtp/evhtp.h:388
evhtp::evbase
struct event_base * evbase
the initialized event_base
Definition: evhtp/evhtp.h:285
evhtp::ssl_ctx
evhtp_ssl_ctx_t * ssl_ctx
if ssl enabled, this is the servers CTX
Definition: evhtp/evhtp.h:307
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 .
Definition: evhtp.c:4405
evhtp_path::full
char * full
the full path+file (/a/b/c.html)
Definition: evhtp/evhtp.h:384
evhtp_connection::parser
htparser * parser
Definition: evhtp/evhtp.h:438
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
Definition: evhtp.c:3323
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
Definition: evhtp.c:3347
evhtp_hook_on_headers
type which defines to hook after all headers have been parsed
Definition: evhtp/evhtp.h:110
evhtp_defaults::cbarg
void * cbarg
Definition: evhtp/evhtp.h:268
evhtp_path::match_start
char * match_start
Definition: evhtp/evhtp.h:387
evhtp_ssl_cfg::scache_del
evhtp_ssl_scache_del scache_del
Definition: evhtp/evhtp.h:523
evhtp_kv
a generic key/value structure
Definition: evhtp/evhtp.h:339
evhtp_unbind_socket
EVHTP_EXPORT void evhtp_unbind_socket(evhtp_t *htp)
stops the listening socket.
Definition: evhtp.c:3924
evhtp_ssl_cfg::args
void * args
Definition: evhtp/evhtp.h:524
evhtp::bev_flags
int bev_flags
bufferevent flags to use on bufferevent_*_socket_new()
Definition: evhtp/evhtp.h:289
evhtp_hook_on_new_chunk
Definition: evhtp/evhtp.h:115
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.
Definition: evhtp.c:4956
evhtp_request::cb
evhtp_callback_cb cb
the function to call when fully processed
Definition: evhtp/evhtp.h:419
evhtp_alias::TAILQ_ENTRY
TAILQ_ENTRY(evhtp_alias) next
evhtp_hooks::on_hostname_arg
void * on_hostname_arg
Definition: evhtp/evhtp.h:495
evhtp_ssl_cfg::x509_verify_cb
evhtp_ssl_verify_cb x509_verify_cb
Definition: evhtp/evhtp.h:513
evhtp::callbacks
evhtp_callbacks_t * callbacks
Definition: evhtp/evhtp.h:324
evhtp_ssl_cfg::pemfile
char * pemfile
Definition: evhtp/evhtp.h:502
evhtp_hook__max
Definition: evhtp/evhtp.h:124
evhtp_connection_pause
EVHTP_EXPORT void evhtp_connection_pause(evhtp_connection_t *connection)
pauses a connection (disables reading)
Definition: evhtp.c:3034
evhtp_hooks::on_error
evhtp_hook_err_cb on_error
Definition: evhtp/evhtp.h:475
evhtp_hooks::on_new_chunk_arg
void * on_new_chunk_arg
Definition: evhtp/evhtp.h:492
evhtp_ssl_cfg::scache_init
evhtp_ssl_scache_init scache_init
Definition: evhtp/evhtp.h:520
evhtp::defaults
evhtp_defaults_t defaults
Definition: evhtp/evhtp.h:325
evhtp_hooks::on_request_fini
evhtp_hook_request_fini_cb on_request_fini
Definition: evhtp/evhtp.h:472
evhtp_callback_type
evhtp_callback_type
Definition: evhtp/evhtp.h:127
evhtp_defaults::pre_accept
evhtp_pre_accept_cb pre_accept
Definition: evhtp/evhtp.h:266
evhtp_ssl_cfg::scache_size
long scache_size
Definition: evhtp/evhtp.h:519
evhtp_hooks::on_request_fini_arg
void * on_request_fini_arg
Definition: evhtp/evhtp.h:488
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.
Definition: evhtp.c:5131
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
Definition: evhtp.c:5014
evhtp_ssl_scache_type_builtin
Definition: evhtp/evhtp.h:101
evhtp_connection::body_bytes_read
uint64_t body_bytes_read
Definition: evhtp/evhtp.h:446
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
Definition: evhtp.c:3237
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: evhtp.c:5540
evhtp_hooks::on_connection_fini
evhtp_hook_connection_fini_cb on_connection_fini
Definition: evhtp/evhtp.h:473
evhtp_x509_t
X509 evhtp_x509_t
Definition: evhtp/evhtp.h:47
evhtp_hook_path_cb
evhtp_res(* evhtp_hook_path_cb)(evhtp_request_t *req, evhtp_path_t *path, void *arg)
Definition: evhtp/evhtp.h:166
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_bod...
Definition: evhtp.c:5050
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)
Definition: evhtp.c:5026
evhtp_authority::port
uint16_t port
port if present in URI
Definition: evhtp/evhtp.h:376
evhtp::parent
evhtp_t * parent
only when this is a vhost
Definition: evhtp/evhtp.h:284
evhtp_path::matched_eoff
unsigned int matched_eoff
offset of where the uri ends mainly used for regex matching
Definition: evhtp/evhtp.h:392
evhtp_pre_accept_cb
evhtp_res(* evhtp_pre_accept_cb)(evhtp_connection_t *conn, void *arg)
Definition: evhtp/evhtp.h:162
evhtp_set_mem_functions
EVHTP_EXPORT void evhtp_set_mem_functions(void *(*malloc_)(size_t), void *(*realloc_)(void *, size_t), void(*free_)(void *))
evhtp_ssl_ctx_t
SSL_CTX evhtp_ssl_ctx_t
Definition: evhtp/evhtp.h:46
evhtp_ssl_sess_t
SSL_SESSION evhtp_ssl_sess_t
Definition: evhtp/evhtp.h:41