libevent  2.2.1
Event notification library
http.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
3  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef EVENT2_HTTP_H_INCLUDED_
28 #define EVENT2_HTTP_H_INCLUDED_
29 
30 /* For int types. */
31 #include <event2/util.h>
32 #include <event2/visibility.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /* In case we haven't included the right headers yet. */
39 struct evbuffer;
40 struct event_base;
41 struct bufferevent;
42 struct evhttp_connection;
43 
55 /* Response codes */
56 #define HTTP_CONTINUE 100
57 #define HTTP_SWITCH_PROTOCOLS 101
58 #define HTTP_PROCESSING 102
59 #define HTTP_EARLYHINTS 103
60 #define HTTP_OK 200
61 #define HTTP_CREATED 201
62 #define HTTP_ACCEPTED 202
63 #define HTTP_NONAUTHORITATIVE 203
64 #define HTTP_NOCONTENT 204
65 #define HTTP_MOVEPERM 301
66 #define HTTP_MOVETEMP 302
67 #define HTTP_NOTMODIFIED 304
68 #define HTTP_BADREQUEST 400
69 #define HTTP_UNAUTHORIZED 401
70 #define HTTP_PAYMENTREQUIRED 402
71 #define HTTP_FORBIDDEN 403
72 #define HTTP_NOTFOUND 404
73 #define HTTP_BADMETHOD 405
74 #define HTTP_ENTITYTOOLARGE 413
75 #define HTTP_EXPECTATIONFAILED 417
76 #define HTTP_INTERNAL 500
77 #define HTTP_NOTIMPLEMENTED 501
78 #define HTTP_BADGATEWAY 502
79 #define HTTP_SERVUNAVAIL 503
81 struct evhttp;
82 struct evhttp_request;
83 struct evkeyvalq;
84 struct evhttp_bound_socket;
85 struct evconnlistener;
86 struct evdns_base;
87 struct evhttp_ext_method;
88 
97 EVENT2_EXPORT_SYMBOL
98 struct evhttp *evhttp_new(struct event_base *base);
99 
112 EVENT2_EXPORT_SYMBOL
113 int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port);
114 
126 EVENT2_EXPORT_SYMBOL
127 struct evhttp_bound_socket *evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t port);
128 
145 EVENT2_EXPORT_SYMBOL
146 int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
147 
158 EVENT2_EXPORT_SYMBOL
159 struct evhttp_bound_socket *evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd);
160 
166 EVENT2_EXPORT_SYMBOL
167 struct evhttp_bound_socket *evhttp_bind_listener(struct evhttp *http, struct evconnlistener *listener);
168 
172 EVENT2_EXPORT_SYMBOL
173 struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound_socket *bound);
174 
175 /*
176  * Like evhttp_set_bevcb.
177  * If cb returns a non-NULL bufferevent, * the callback supplied through
178  * evhttp_set_bevcb isn't used.
179  */
180 EVENT2_EXPORT_SYMBOL
181 void evhttp_bound_set_bevcb(struct evhttp_bound_socket *bound, struct bufferevent* (*cb)(struct event_base *, void *), void *cbarg);
182 
183 typedef void evhttp_bound_socket_foreach_fn(struct evhttp_bound_socket *, void *);
194 EVENT2_EXPORT_SYMBOL
195 void evhttp_foreach_bound_socket(struct evhttp *http, evhttp_bound_socket_foreach_fn *function, void *argument);
196 
214 EVENT2_EXPORT_SYMBOL
215 void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound_socket);
216 
224 EVENT2_EXPORT_SYMBOL
225 evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket);
226 
235 EVENT2_EXPORT_SYMBOL
236 void evhttp_free(struct evhttp* http);
237 
239 EVENT2_EXPORT_SYMBOL
240 void evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_headers_size);
242 EVENT2_EXPORT_SYMBOL
243 void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size);
244 
252 EVENT2_EXPORT_SYMBOL
253 void evhttp_set_max_connections(struct evhttp* http, int max_connections);
254 
260 EVENT2_EXPORT_SYMBOL
261 int evhttp_get_connection_count(struct evhttp* http);
262 
271 EVENT2_EXPORT_SYMBOL
272 void evhttp_set_default_content_type(struct evhttp *http,
273  const char *content_type);
274 
286 EVENT2_EXPORT_SYMBOL
287 void evhttp_set_allowed_methods(struct evhttp* http, ev_uint32_t methods);
288 
289 typedef int (*evhttp_ext_method_cb)(struct evhttp_ext_method *);
306 EVENT2_EXPORT_SYMBOL
307 void evhttp_set_ext_method_cmp(struct evhttp *http, evhttp_ext_method_cb cmp);
308 
318 EVENT2_EXPORT_SYMBOL
319 int evhttp_set_cb(struct evhttp *http, const char *path,
320  void (*cb)(struct evhttp_request *, void *), void *cb_arg);
321 
323 EVENT2_EXPORT_SYMBOL
324 int evhttp_del_cb(struct evhttp *, const char *);
325 
337 EVENT2_EXPORT_SYMBOL
338 void evhttp_set_gencb(struct evhttp *http,
339  void (*cb)(struct evhttp_request *, void *), void *arg);
340 
357 EVENT2_EXPORT_SYMBOL
358 void evhttp_set_bevcb(struct evhttp *http,
359  struct bufferevent *(*cb)(struct event_base *, void *), void *arg);
360 
361 
375 EVENT2_EXPORT_SYMBOL
376 void evhttp_set_newreqcb(struct evhttp *http,
377  int (*cb)(struct evhttp_request*, void *), void *arg);
378 
401 EVENT2_EXPORT_SYMBOL
402 void evhttp_set_errorcb(struct evhttp *http,
403  int (*cb)(struct evhttp_request *req, struct evbuffer *buffer, int error, const char *reason, void *cbarg),
404  void *cbarg);
405 
428 EVENT2_EXPORT_SYMBOL
429 int evhttp_add_virtual_host(struct evhttp* http, const char *pattern,
430  struct evhttp* vhost);
431 
440 EVENT2_EXPORT_SYMBOL
441 int evhttp_remove_virtual_host(struct evhttp* http, struct evhttp* vhost);
442 
451 EVENT2_EXPORT_SYMBOL
452 int evhttp_add_server_alias(struct evhttp *http, const char *alias);
453 
461 EVENT2_EXPORT_SYMBOL
462 int evhttp_remove_server_alias(struct evhttp *http, const char *alias);
463 
471 EVENT2_EXPORT_SYMBOL
472 void evhttp_set_timeout(struct evhttp *http, int timeout);
473 
484 EVENT2_EXPORT_SYMBOL
485 void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval* tv);
486 
493 EVENT2_EXPORT_SYMBOL
494 void evhttp_set_read_timeout_tv(struct evhttp *http, const struct timeval* tv);
495 
502 EVENT2_EXPORT_SYMBOL
503 void evhttp_set_write_timeout_tv(struct evhttp *http, const struct timeval* tv);
504 
505 /* Read all the clients body, and only after this respond with an error if the
506  * clients body exceed max_body_size */
507 #define EVHTTP_SERVER_LINGERING_CLOSE 0x0001
508 
515 EVENT2_EXPORT_SYMBOL
516 int evhttp_set_flags(struct evhttp *http, int flags);
517 
518 /* Request/Response functionality */
519 
528 EVENT2_EXPORT_SYMBOL
529 void evhttp_send_error(struct evhttp_request *req, int error,
530  const char *reason);
531 
545 EVENT2_EXPORT_SYMBOL
546 void evhttp_send_reply(struct evhttp_request *req, int code,
547  const char *reason, struct evbuffer *databuf);
548 
549 /* Low-level response interface, for streaming/chunked replies */
550 
565 EVENT2_EXPORT_SYMBOL
566 void evhttp_send_reply_start(struct evhttp_request *req, int code,
567  const char *reason);
568 
580 EVENT2_EXPORT_SYMBOL
581 void evhttp_send_reply_chunk(struct evhttp_request *req,
582  struct evbuffer *databuf);
583 
597 EVENT2_EXPORT_SYMBOL
598 void evhttp_send_reply_chunk_with_cb(struct evhttp_request *req, struct evbuffer *databuf,
599  void (*cb)(struct evhttp_connection *, void *), void *arg);
600 
606 EVENT2_EXPORT_SYMBOL
607 void evhttp_send_reply_end(struct evhttp_request *req);
608 
609 /*
610  * Interfaces for making requests
611  */
612 
624  EVHTTP_REQ_GET = 1 << 0,
625  EVHTTP_REQ_POST = 1 << 1,
626  EVHTTP_REQ_HEAD = 1 << 2,
627  EVHTTP_REQ_PUT = 1 << 3,
628  EVHTTP_REQ_DELETE = 1 << 4,
629  EVHTTP_REQ_OPTIONS = 1 << 5,
630  EVHTTP_REQ_TRACE = 1 << 6,
631  EVHTTP_REQ_CONNECT = 1 << 7,
632  EVHTTP_REQ_PATCH = 1 << 8,
633  EVHTTP_REQ_PROPFIND= 1 << 9,
634  EVHTTP_REQ_PROPPATCH=1 << 10,
635  EVHTTP_REQ_MKCOL = 1 << 11,
636  EVHTTP_REQ_LOCK = 1 << 12,
637  EVHTTP_REQ_UNLOCK = 1 << 13,
638  EVHTTP_REQ_COPY = 1 << 14,
639  EVHTTP_REQ_MOVE = 1 << 15,
640 };
641 
642 #define EVHTTP_REQ_MAX EVHTTP_REQ_MOVE
643 
652  const char *method;
653  ev_uint32_t type; /* @see enum evhttp_cmd_type */
654  ev_uint16_t flags; /* Available flag : EVHTTP_METHOD_HAS_BODY */
655 };
656 
657 #define EVHTTP_METHOD_HAS_BODY 0x0001
658 
660 enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
661 
683 EVENT2_EXPORT_SYMBOL
684 struct evhttp_connection *evhttp_connection_base_bufferevent_new(
685  struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, ev_uint16_t port);
686 
698 EVENT2_EXPORT_SYMBOL
699 struct evhttp_connection *evhttp_connection_base_bufferevent_unix_new(
700  struct event_base *base, struct bufferevent* bev, const char *path);
701 
716 EVENT2_EXPORT_SYMBOL
717 struct evhttp_connection *
718 evhttp_connection_base_bufferevent_reuse_new(struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev);
719 
723 EVENT2_EXPORT_SYMBOL
724 struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon);
725 
729 EVENT2_EXPORT_SYMBOL
730 struct evhttp *evhttp_connection_get_server(struct evhttp_connection *evcon);
731 
737 EVENT2_EXPORT_SYMBOL
738 struct evhttp_request *evhttp_request_new(
739  void (*cb)(struct evhttp_request *, void *), void *arg);
740 
748 EVENT2_EXPORT_SYMBOL
749 void evhttp_request_set_chunked_cb(struct evhttp_request *,
750  void (*cb)(struct evhttp_request *, void *));
751 
758 EVENT2_EXPORT_SYMBOL
759 void evhttp_request_set_header_cb(struct evhttp_request *,
760  int (*cb)(struct evhttp_request *, void *));
761 
792 };
800 EVENT2_EXPORT_SYMBOL
801 void evhttp_request_set_error_cb(struct evhttp_request *,
802  void (*)(enum evhttp_request_error, void *));
803 
816 EVENT2_EXPORT_SYMBOL
817 void evhttp_request_set_on_complete_cb(struct evhttp_request *req,
818  void (*cb)(struct evhttp_request *, void *), void *cb_arg);
819 
821 EVENT2_EXPORT_SYMBOL
822 void evhttp_request_free(struct evhttp_request *req);
823 
837 EVENT2_EXPORT_SYMBOL
838 struct evhttp_connection *evhttp_connection_base_new(
839  struct event_base *base, struct evdns_base *dnsbase,
840  const char *address, ev_uint16_t port);
841 
845 EVENT2_EXPORT_SYMBOL
846 void evhttp_connection_set_family(struct evhttp_connection *evcon,
847  int family);
848 
849 /* reuse connection address on retry */
850 #define EVHTTP_CON_REUSE_CONNECTED_ADDR 0x0008
851 /* Try to read error, since server may already send and close
852  * connection, but if at that time we have some data to send then we
853  * can send get EPIPE and fail, while we can read that HTTP error. */
854 #define EVHTTP_CON_READ_ON_WRITE_ERROR 0x0010
855 /* @see EVHTTP_SERVER_LINGERING_CLOSE */
856 #define EVHTTP_CON_LINGERING_CLOSE 0x0020
857 /* Padding for public flags, @see EVHTTP_CON_* in http-internal.h */
858 #define EVHTTP_CON_PUBLIC_FLAGS_END 0x100000
859 
866 EVENT2_EXPORT_SYMBOL
867 int evhttp_connection_set_flags(struct evhttp_connection *evcon,
868  int flags);
869 
875 EVENT2_EXPORT_SYMBOL
876 void evhttp_request_own(struct evhttp_request *req);
877 
879 EVENT2_EXPORT_SYMBOL
880 int evhttp_request_is_owned(struct evhttp_request *req);
881 
887 EVENT2_EXPORT_SYMBOL
888 void evhttp_connection_set_ext_method_cmp(struct evhttp_connection *evcon,
889  evhttp_ext_method_cb cmp);
890 
897 EVENT2_EXPORT_SYMBOL
898 struct evhttp_connection *evhttp_request_get_connection(struct evhttp_request *req);
899 
903 EVENT2_EXPORT_SYMBOL
904 struct event_base *evhttp_connection_get_base(struct evhttp_connection *req);
905 
906 EVENT2_EXPORT_SYMBOL
907 void evhttp_connection_set_max_headers_size(struct evhttp_connection *evcon,
908  ev_ssize_t new_max_headers_size);
909 
910 EVENT2_EXPORT_SYMBOL
911 void evhttp_connection_set_max_body_size(struct evhttp_connection* evcon,
912  ev_ssize_t new_max_body_size);
913 
915 EVENT2_EXPORT_SYMBOL
916 void evhttp_connection_free(struct evhttp_connection *evcon);
917 
923 EVENT2_EXPORT_SYMBOL
924 void evhttp_connection_free_on_completion(struct evhttp_connection *evcon);
925 
931 EVENT2_EXPORT_SYMBOL
932 void evhttp_connection_set_local_address(struct evhttp_connection *evcon,
933  const char *address);
934 
936 EVENT2_EXPORT_SYMBOL
937 void evhttp_connection_set_local_port(struct evhttp_connection *evcon,
938  ev_uint16_t port);
939 
945 EVENT2_EXPORT_SYMBOL
946 void evhttp_connection_set_timeout(struct evhttp_connection *evcon,
947  int timeout);
948 
963 EVENT2_EXPORT_SYMBOL
964 void evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon,
965  const struct timeval *tv);
966 
972 EVENT2_EXPORT_SYMBOL
973 void evhttp_connection_set_connect_timeout_tv(struct evhttp_connection *evcon,
974  const struct timeval *tv);
975 
981 EVENT2_EXPORT_SYMBOL
982 void evhttp_connection_set_read_timeout_tv(struct evhttp_connection *evcon,
983  const struct timeval *tv);
984 
990 EVENT2_EXPORT_SYMBOL
991 void evhttp_connection_set_write_timeout_tv(struct evhttp_connection *evcon,
992  const struct timeval *tv);
993 
1003 EVENT2_EXPORT_SYMBOL
1004 void evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon,
1005  const struct timeval *tv);
1006 
1008 EVENT2_EXPORT_SYMBOL
1009 void evhttp_connection_set_retries(struct evhttp_connection *evcon,
1010  int retry_max);
1011 
1013 EVENT2_EXPORT_SYMBOL
1014 void evhttp_connection_set_closecb(struct evhttp_connection *evcon,
1015  void (*)(struct evhttp_connection *, void *), void *);
1016 
1018 EVENT2_EXPORT_SYMBOL
1019 void evhttp_connection_get_peer(struct evhttp_connection *evcon,
1020  const char **address, ev_uint16_t *port);
1021 
1028 EVENT2_EXPORT_SYMBOL
1029 const struct sockaddr*
1030 evhttp_connection_get_addr(struct evhttp_connection *evcon);
1031 
1045 EVENT2_EXPORT_SYMBOL
1046 int evhttp_make_request(struct evhttp_connection *evcon,
1047  struct evhttp_request *req,
1048  enum evhttp_cmd_type type, const char *uri);
1049 
1063 EVENT2_EXPORT_SYMBOL
1064 void evhttp_cancel_request(struct evhttp_request *req);
1065 
1069 struct evhttp_uri;
1070 
1072 EVENT2_EXPORT_SYMBOL
1073 const char *evhttp_request_get_uri(const struct evhttp_request *req);
1075 EVENT2_EXPORT_SYMBOL
1076 const struct evhttp_uri *evhttp_request_get_evhttp_uri(const struct evhttp_request *req);
1078 EVENT2_EXPORT_SYMBOL
1079 enum evhttp_cmd_type evhttp_request_get_command(const struct evhttp_request *req);
1080 
1081 EVENT2_EXPORT_SYMBOL
1082 int evhttp_request_get_response_code(const struct evhttp_request *req);
1083 EVENT2_EXPORT_SYMBOL
1084 const char * evhttp_request_get_response_code_line(const struct evhttp_request *req);
1085 
1087 EVENT2_EXPORT_SYMBOL
1088 struct evkeyvalq *evhttp_request_get_input_headers(struct evhttp_request *req);
1090 EVENT2_EXPORT_SYMBOL
1091 struct evkeyvalq *evhttp_request_get_output_headers(struct evhttp_request *req);
1093 EVENT2_EXPORT_SYMBOL
1094 struct evbuffer *evhttp_request_get_input_buffer(struct evhttp_request *req);
1096 EVENT2_EXPORT_SYMBOL
1097 struct evbuffer *evhttp_request_get_output_buffer(struct evhttp_request *req);
1102 EVENT2_EXPORT_SYMBOL
1103 const char *evhttp_request_get_host(struct evhttp_request *req);
1104 
1105 /* Interfaces for dealing with HTTP headers */
1106 
1116 EVENT2_EXPORT_SYMBOL
1117 const char *evhttp_find_header(const struct evkeyvalq *headers,
1118  const char *key);
1119 
1128 EVENT2_EXPORT_SYMBOL
1129 int evhttp_remove_header(struct evkeyvalq *headers, const char *key);
1130 
1140 EVENT2_EXPORT_SYMBOL
1141 int evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *value);
1142 
1148 EVENT2_EXPORT_SYMBOL
1149 void evhttp_clear_headers(struct evkeyvalq *headers);
1150 
1151 /* Miscellaneous utility functions */
1152 
1153 
1165 EVENT2_EXPORT_SYMBOL
1166 char *evhttp_encode_uri(const char *str);
1167 
1182 EVENT2_EXPORT_SYMBOL
1183 char *evhttp_uriencode(const char *str, ev_ssize_t size, int space_to_plus);
1184 
1199 EVENT2_EXPORT_SYMBOL
1200 char *evhttp_decode_uri(const char *uri);
1201 
1217 EVENT2_EXPORT_SYMBOL
1218 char *evhttp_uridecode(const char *uri, int decode_plus,
1219  size_t *size_out);
1220 
1240 EVENT2_EXPORT_SYMBOL
1241 int evhttp_parse_query(const char *uri, struct evkeyvalq *headers);
1242 
1244 EVENT2_EXPORT_SYMBOL
1245 int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers);
1246 
1261 #define EVHTTP_URI_QUERY_NONCONFORMANT 0x01
1262 
1268 #define EVHTTP_URI_QUERY_LAST_VAL 0x02
1269 
1288 EVENT2_EXPORT_SYMBOL
1289 int evhttp_parse_query_str_flags(const char *uri, struct evkeyvalq *headers, unsigned flags);
1290 
1302 EVENT2_EXPORT_SYMBOL
1303 char *evhttp_htmlescape(const char *html);
1304 
1308 EVENT2_EXPORT_SYMBOL
1309 struct evhttp_uri *evhttp_uri_new(void);
1310 
1315 EVENT2_EXPORT_SYMBOL
1316 void evhttp_uri_set_flags(struct evhttp_uri *uri, unsigned flags);
1317 
1320 EVENT2_EXPORT_SYMBOL
1321 const char *evhttp_uri_get_scheme(const struct evhttp_uri *uri);
1326 EVENT2_EXPORT_SYMBOL
1327 const char *evhttp_uri_get_userinfo(const struct evhttp_uri *uri);
1340 EVENT2_EXPORT_SYMBOL
1341 const char *evhttp_uri_get_host(const struct evhttp_uri *uri);
1344 EVENT2_EXPORT_SYMBOL
1345 const char *evhttp_uri_get_unixsocket(const struct evhttp_uri *uri);
1347 EVENT2_EXPORT_SYMBOL
1348 int evhttp_uri_get_port(const struct evhttp_uri *uri);
1350 EVENT2_EXPORT_SYMBOL
1351 const char *evhttp_uri_get_path(const struct evhttp_uri *uri);
1354 EVENT2_EXPORT_SYMBOL
1355 const char *evhttp_uri_get_query(const struct evhttp_uri *uri);
1358 EVENT2_EXPORT_SYMBOL
1359 const char *evhttp_uri_get_fragment(const struct evhttp_uri *uri);
1360 
1363 EVENT2_EXPORT_SYMBOL
1364 int evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme);
1367 EVENT2_EXPORT_SYMBOL
1368 int evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo);
1371 EVENT2_EXPORT_SYMBOL
1372 int evhttp_uri_set_host(struct evhttp_uri *uri, const char *host);
1375 EVENT2_EXPORT_SYMBOL
1376 int evhttp_uri_set_unixsocket(struct evhttp_uri *uri, const char *unixsocket);
1377 
1380 EVENT2_EXPORT_SYMBOL
1381 int evhttp_uri_set_port(struct evhttp_uri *uri, int port);
1384 EVENT2_EXPORT_SYMBOL
1385 int evhttp_uri_set_path(struct evhttp_uri *uri, const char *path);
1389 EVENT2_EXPORT_SYMBOL
1390 int evhttp_uri_set_query(struct evhttp_uri *uri, const char *query);
1394 EVENT2_EXPORT_SYMBOL
1395 int evhttp_uri_set_fragment(struct evhttp_uri *uri, const char *fragment);
1396 
1431 EVENT2_EXPORT_SYMBOL
1432 struct evhttp_uri *evhttp_uri_parse_with_flags(const char *source_uri,
1433  unsigned flags);
1434 
1447 #define EVHTTP_URI_NONCONFORMANT 0x01
1448 
1457 #define EVHTTP_URI_HOST_STRIP_BRACKETS 0x04
1458 
1464 #define EVHTTP_URI_UNIX_SOCKET 0x08
1465 
1467 EVENT2_EXPORT_SYMBOL
1468 struct evhttp_uri *evhttp_uri_parse(const char *source_uri);
1469 
1477 EVENT2_EXPORT_SYMBOL
1478 void evhttp_uri_free(struct evhttp_uri *uri);
1479 
1493 EVENT2_EXPORT_SYMBOL
1494 char *evhttp_uri_join(const struct evhttp_uri *uri, char *buf, size_t limit);
1495 
1496 #ifdef __cplusplus
1497 }
1498 #endif
1499 
1500 #endif /* EVENT2_HTTP_H_INCLUDED_ */
evhttp_decode_uri
EVENT2_EXPORT_SYMBOL char * evhttp_decode_uri(const char *uri)
Helper function to sort of decode a URI-encoded string.
evhttp_request_free
EVENT2_EXPORT_SYMBOL void evhttp_request_free(struct evhttp_request *req)
Frees the request object and removes associated events.
evhttp_connection_set_family
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_family(struct evhttp_connection *evcon, int family)
Set family hint for DNS requests.
evhttp_foreach_bound_socket
EVENT2_EXPORT_SYMBOL void evhttp_foreach_bound_socket(struct evhttp *http, evhttp_bound_socket_foreach_fn *function, void *argument)
Applies the function specified in the first argument to all evhttp_bound_sockets associated with "htt...
evhttp_connection_set_ext_method_cmp
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_ext_method_cmp(struct evhttp_connection *evcon, evhttp_ext_method_cb cmp)
Sets extended method cmp callback for this http connection.
evhttp_request_get_input_headers
EVENT2_EXPORT_SYMBOL struct evkeyvalq * evhttp_request_get_input_headers(struct evhttp_request *req)
Returns the input headers.
evhttp_connection_set_retries
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_retries(struct evhttp_connection *evcon, int retry_max)
Sets the retry limit for this connection - -1 repeats indefinitely.
evhttp_remove_server_alias
EVENT2_EXPORT_SYMBOL int evhttp_remove_server_alias(struct evhttp *http, const char *alias)
Remove a server alias from an http object.
evhttp_connection_set_write_timeout_tv
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_write_timeout_tv(struct evhttp_connection *evcon, const struct timeval *tv)
Sets the write timeout for this connection.
evhttp_bound_socket_get_listener
EVENT2_EXPORT_SYMBOL struct evconnlistener * evhttp_bound_socket_get_listener(struct evhttp_bound_socket *bound)
Return the listener used to implement a bound socket.
evhttp_connection_get_server
EVENT2_EXPORT_SYMBOL struct evhttp * evhttp_connection_get_server(struct evhttp_connection *evcon)
Return the HTTP server associated with this connection, or NULL.
evhttp_request_set_on_complete_cb
EVENT2_EXPORT_SYMBOL void evhttp_request_set_on_complete_cb(struct evhttp_request *req, void(*cb)(struct evhttp_request *, void *), void *cb_arg)
Set a callback to be called on request completion of evhttp_send_* function.
evhttp_connection_get_addr
EVENT2_EXPORT_SYMBOL const struct sockaddr * evhttp_connection_get_addr(struct evhttp_connection *evcon)
Get the remote address associated with this connection.
evhttp_connection_get_bufferevent
EVENT2_EXPORT_SYMBOL struct bufferevent * evhttp_connection_get_bufferevent(struct evhttp_connection *evcon)
Return the bufferevent that an evhttp_connection is using.
evhttp_set_read_timeout_tv
EVENT2_EXPORT_SYMBOL void evhttp_set_read_timeout_tv(struct evhttp *http, const struct timeval *tv)
Set read timeout for an HTTP request.
evhttp_bound_socket_get_fd
EVENT2_EXPORT_SYMBOL evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket)
Get the raw file descriptor referenced by an evhttp_bound_socket.
evhttp_set_max_headers_size
EVENT2_EXPORT_SYMBOL void evhttp_set_max_headers_size(struct evhttp *http, ev_ssize_t max_headers_size)
XXX Document.
evhttp_request_get_uri
const EVENT2_EXPORT_SYMBOL char * evhttp_request_get_uri(const struct evhttp_request *req)
Returns the request URI.
evhttp_send_reply_end
EVENT2_EXPORT_SYMBOL void evhttp_send_reply_end(struct evhttp_request *req)
Complete a chunked reply, freeing the request as appropriate.
evhttp_set_bevcb
EVENT2_EXPORT_SYMBOL void evhttp_set_bevcb(struct evhttp *http, struct bufferevent *(*cb)(struct event_base *, void *), void *arg)
Set a callback used to create new bufferevents for connections to a given evhttp object.
evhttp_connection_set_flags
EVENT2_EXPORT_SYMBOL int evhttp_connection_set_flags(struct evhttp_connection *evcon, int flags)
Set connection flags.
evhttp_uri_join
EVENT2_EXPORT_SYMBOL char * evhttp_uri_join(const struct evhttp_uri *uri, char *buf, size_t limit)
Join together the uri parts from parsed data to form a URI-Reference.
evhttp_uri_set_userinfo
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo)
Set the userinfo of an evhttp_uri, or clear the userinfo if userinfo==NULL.
evhttp_clear_headers
EVENT2_EXPORT_SYMBOL void evhttp_clear_headers(struct evkeyvalq *headers)
Removes all headers from the header list.
EVREQ_HTTP_EOF
@ EVREQ_HTTP_EOF
EOF reached.
Definition: http.h:775
evhttp_uri_set_fragment
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_fragment(struct evhttp_uri *uri, const char *fragment)
Set the fragment of an evhttp_uri, or clear the fragment if fragment==NULL.
evhttp_set_errorcb
EVENT2_EXPORT_SYMBOL void evhttp_set_errorcb(struct evhttp *http, int(*cb)(struct evhttp_request *req, struct evbuffer *buffer, int error, const char *reason, void *cbarg), void *cbarg)
Set a callback to output for any error pages sent for requests of a given evhttp object.
evhttp_uri_free
EVENT2_EXPORT_SYMBOL void evhttp_uri_free(struct evhttp_uri *uri)
Free all memory allocated for a parsed uri.
evhttp_request_set_error_cb
EVENT2_EXPORT_SYMBOL void evhttp_request_set_error_cb(struct evhttp_request *, void(*)(enum evhttp_request_error, void *))
Set a callback for errors.
evhttp_connection_base_bufferevent_reuse_new
EVENT2_EXPORT_SYMBOL struct evhttp_connection * evhttp_connection_base_bufferevent_reuse_new(struct event_base *base, struct evdns_base *dnsbase, struct bufferevent *bev)
Create and return a connection object that can be used to for making HTTP requests.
evhttp_uri_set_port
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_port(struct evhttp_uri *uri, int port)
Set the port of an evhttp_uri, or clear the port if port==-1.
event_base
Structure to hold information and state for a Libevent dispatch loop.
Definition: event.h:219
EVREQ_HTTP_BUFFER_ERROR
@ EVREQ_HTTP_BUFFER_ERROR
Error encountered while reading or writing.
Definition: http.h:783
evhttp_set_allowed_methods
EVENT2_EXPORT_SYMBOL void evhttp_set_allowed_methods(struct evhttp *http, ev_uint32_t methods)
Sets the what HTTP methods are supported in requests accepted by this server, and passed to user call...
evhttp_connection_set_local_port
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_local_port(struct evhttp_connection *evcon, ev_uint16_t port)
sets the local port from which http connections are made
evhttp_set_timeout_tv
EVENT2_EXPORT_SYMBOL void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval *tv)
Set read and write timeout for an HTTP request.
evhttp_uri_get_query
const EVENT2_EXPORT_SYMBOL char * evhttp_uri_get_query(const struct evhttp_uri *uri)
Return the query part of an evhttp_uri (excluding the leading "?"), or NULL if it has no query set.
evhttp_remove_header
EVENT2_EXPORT_SYMBOL int evhttp_remove_header(struct evkeyvalq *headers, const char *key)
Removes a header from a list of existing headers.
evhttp_add_virtual_host
EVENT2_EXPORT_SYMBOL int evhttp_add_virtual_host(struct evhttp *http, const char *pattern, struct evhttp *vhost)
Adds a virtual host to the http server.
evhttp_send_reply_start
EVENT2_EXPORT_SYMBOL void evhttp_send_reply_start(struct evhttp_request *req, int code, const char *reason)
Initiate a reply that uses Transfer-Encoding chunked.
evhttp_set_max_body_size
EVENT2_EXPORT_SYMBOL void evhttp_set_max_body_size(struct evhttp *http, ev_ssize_t max_body_size)
XXX Document.
evhttp_add_server_alias
EVENT2_EXPORT_SYMBOL int evhttp_add_server_alias(struct evhttp *http, const char *alias)
Add a server alias to an http object.
evhttp_send_reply
EVENT2_EXPORT_SYMBOL void evhttp_send_reply(struct evhttp_request *req, int code, const char *reason, struct evbuffer *databuf)
Send an HTML reply to the client.
evhttp_make_request
EVENT2_EXPORT_SYMBOL int evhttp_make_request(struct evhttp_connection *evcon, struct evhttp_request *req, enum evhttp_cmd_type type, const char *uri)
Make an HTTP request over the specified connection.
evhttp_set_cb
EVENT2_EXPORT_SYMBOL int evhttp_set_cb(struct evhttp *http, const char *path, void(*cb)(struct evhttp_request *, void *), void *cb_arg)
Set a callback for a specified URI.
evhttp_request_error
evhttp_request_error
The different error types supported by evhttp.
Definition: http.h:767
evhttp_set_flags
EVENT2_EXPORT_SYMBOL int evhttp_set_flags(struct evhttp *http, int flags)
Set connection flags for HTTP server.
evhttp_connection_set_read_timeout_tv
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_read_timeout_tv(struct evhttp_connection *evcon, const struct timeval *tv)
Sets the read timeout for this connection.
evhttp_connection_set_local_address
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_local_address(struct evhttp_connection *evcon, const char *address)
Sets the IP address from which http connections are made.
evhttp_parse_query_str_flags
EVENT2_EXPORT_SYMBOL int evhttp_parse_query_str_flags(const char *uri, struct evkeyvalq *headers, unsigned flags)
Helper function to parse out arguments from the query portion of an HTTP URI.
evhttp_connection_set_connect_timeout_tv
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_connect_timeout_tv(struct evhttp_connection *evcon, const struct timeval *tv)
Sets the connect timeout for this connection.
evhttp_connection_get_base
EVENT2_EXPORT_SYMBOL struct event_base * evhttp_connection_get_base(struct evhttp_connection *req)
Returns the underlying event_base for this connection.
evhttp_uri_set_query
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_query(struct evhttp_uri *uri, const char *query)
Set the query of an evhttp_uri, or clear the query if query==NULL.
evhttp_set_newreqcb
EVENT2_EXPORT_SYMBOL void evhttp_set_newreqcb(struct evhttp *http, int(*cb)(struct evhttp_request *, void *), void *arg)
Set a callback which allows the user to note or throttle incoming requests.
EVREQ_HTTP_REQUEST_CANCEL
@ EVREQ_HTTP_REQUEST_CANCEL
The evhttp_cancel_request() called on this request.
Definition: http.h:787
EVREQ_HTTP_INVALID_HEADER
@ EVREQ_HTTP_INVALID_HEADER
Error while reading header, or invalid header.
Definition: http.h:779
evhttp_uri_get_port
EVENT2_EXPORT_SYMBOL int evhttp_uri_get_port(const struct evhttp_uri *uri)
Return the port part of an evhttp_uri, or -1 if there is no port set.
evhttp_set_timeout
EVENT2_EXPORT_SYMBOL void evhttp_set_timeout(struct evhttp *http, int timeout)
Set the timeout for an HTTP request.
bufferevent
An opaque type for handling buffered IO.
Definition: bufferevent.h:114
evhttp_connection_set_closecb
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_closecb(struct evhttp_connection *evcon, void(*)(struct evhttp_connection *, void *), void *)
Set a callback for connection close.
evhttp_request_own
EVENT2_EXPORT_SYMBOL void evhttp_request_own(struct evhttp_request *req)
Takes ownership of the request object.
evhttp_get_connection_count
EVENT2_EXPORT_SYMBOL int evhttp_get_connection_count(struct evhttp *http)
Get the current number of connections.
evhttp_connection_base_bufferevent_new
EVENT2_EXPORT_SYMBOL struct evhttp_connection * evhttp_connection_base_bufferevent_new(struct event_base *base, struct evdns_base *dnsbase, struct bufferevent *bev, const char *address, ev_uint16_t port)
Create and return a connection object that can be used to for making HTTP requests.
evhttp_uri_get_path
const EVENT2_EXPORT_SYMBOL char * evhttp_uri_get_path(const struct evhttp_uri *uri)
Return the path part of an evhttp_uri, or NULL if it has no path set.
evhttp_uri_set_path
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_path(struct evhttp_uri *uri, const char *path)
Set the path of an evhttp_uri, or clear the path if path==NULL.
evhttp_accept_socket
EVENT2_EXPORT_SYMBOL int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd)
Makes an HTTP server accept connections on the specified socket.
evhttp_request_get_input_buffer
EVENT2_EXPORT_SYMBOL struct evbuffer * evhttp_request_get_input_buffer(struct evhttp_request *req)
Returns the input buffer.
evhttp_remove_virtual_host
EVENT2_EXPORT_SYMBOL int evhttp_remove_virtual_host(struct evhttp *http, struct evhttp *vhost)
Removes a virtual host from the http server.
evhttp_free
EVENT2_EXPORT_SYMBOL void evhttp_free(struct evhttp *http)
Free the previously created HTTP server.
evhttp_uri_set_host
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_host(struct evhttp_uri *uri, const char *host)
Set the host of an evhttp_uri, or clear the host if host==NULL.
evhttp_ext_method
structure that is passed to (and modified by) the extended method callback function
Definition: http.h:651
evbuffer
An evbuffer is an opaque data type for efficiently buffering data to be sent or received on the netwo...
Definition: buffer.h:97
evhttp_connection_set_initial_retry_tv
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon, const struct timeval *tv)
Sets the delay before retrying requests on this connection.
evhttp_request_get_output_buffer
EVENT2_EXPORT_SYMBOL struct evbuffer * evhttp_request_get_output_buffer(struct evhttp_request *req)
Returns the output buffer.
evhttp_request_get_host
const EVENT2_EXPORT_SYMBOL char * evhttp_request_get_host(struct evhttp_request *req)
Returns the host associated with the request.
evhttp_uri_get_userinfo
const EVENT2_EXPORT_SYMBOL char * evhttp_uri_get_userinfo(const struct evhttp_uri *uri)
Return the userinfo part of an evhttp_uri, or NULL if it has no userinfo set.
evhttp_request_get_command
EVENT2_EXPORT_SYMBOL enum evhttp_cmd_type evhttp_request_get_command(const struct evhttp_request *req)
Returns the request command.
evhttp_new
EVENT2_EXPORT_SYMBOL struct evhttp * evhttp_new(struct event_base *base)
Create a new HTTP server.
evhttp_request_is_owned
EVENT2_EXPORT_SYMBOL int evhttp_request_is_owned(struct evhttp_request *req)
Returns 1 if the request is owned by the user.
evhttp_connection_set_timeout
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_timeout(struct evhttp_connection *evcon, int timeout)
Sets the timeout for this connection.
evhttp_request_new
EVENT2_EXPORT_SYMBOL struct evhttp_request * evhttp_request_new(void(*cb)(struct evhttp_request *, void *), void *arg)
Creates a new request object that needs to be filled in with the request parameters.
evhttp_connection_free_on_completion
EVENT2_EXPORT_SYMBOL void evhttp_connection_free_on_completion(struct evhttp_connection *evcon)
Disowns a given connection object.
evhttp_bind_socket_with_handle
EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket * evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t port)
Like evhttp_bind_socket(), but returns a handle for referencing the socket.
evhttp_parse_query
EVENT2_EXPORT_SYMBOL int evhttp_parse_query(const char *uri, struct evkeyvalq *headers)
Helper function to parse out arguments in a query.
evhttp_uri_new
EVENT2_EXPORT_SYMBOL struct evhttp_uri * evhttp_uri_new(void)
Return a new empty evhttp_uri with no fields set.
evhttp_bind_socket
EVENT2_EXPORT_SYMBOL int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port)
Binds an HTTP server on the specified address and port.
evhttp_connection_base_bufferevent_unix_new
EVENT2_EXPORT_SYMBOL struct evhttp_connection * evhttp_connection_base_bufferevent_unix_new(struct event_base *base, struct bufferevent *bev, const char *path)
Create and return a connection object that can be used to for making HTTP requests over an unix domai...
evhttp_set_write_timeout_tv
EVENT2_EXPORT_SYMBOL void evhttp_set_write_timeout_tv(struct evhttp *http, const struct timeval *tv)
Set write timeout for an HTTP request.
evhttp_uri_parse_with_flags
EVENT2_EXPORT_SYMBOL struct evhttp_uri * evhttp_uri_parse_with_flags(const char *source_uri, unsigned flags)
Helper function to parse a URI-Reference as specified by RFC3986.
evhttp_del_accept_socket
EVENT2_EXPORT_SYMBOL void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound_socket)
Makes an HTTP server stop accepting connections on the specified socket.
evhttp_send_reply_chunk
EVENT2_EXPORT_SYMBOL void evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf)
Send another data chunk as part of an ongoing chunked reply.
evhttp_cmd_type
evhttp_cmd_type
The different request types supported by evhttp.
Definition: http.h:623
evhttp_request_kind
evhttp_request_kind
a request object can represent either a request or a reply
Definition: http.h:660
evhttp_uri_parse
EVENT2_EXPORT_SYMBOL struct evhttp_uri * evhttp_uri_parse(const char *source_uri)
Alias for evhttp_uri_parse_with_flags(source_uri, 0)
evhttp_connection_set_timeout_tv
EVENT2_EXPORT_SYMBOL void evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon, const struct timeval *tv)
Sets the timeout for this connection for the following events:
evhttp_request_set_header_cb
EVENT2_EXPORT_SYMBOL void evhttp_request_set_header_cb(struct evhttp_request *, int(*cb)(struct evhttp_request *, void *))
Register callback for additional parsing of request headers.
evhttp_uri_get_unixsocket
const EVENT2_EXPORT_SYMBOL char * evhttp_uri_get_unixsocket(const struct evhttp_uri *uri)
Return the unix socket part of an evhttp_uri, or NULL if there is no unix socket set.
evhttp_request_set_chunked_cb
EVENT2_EXPORT_SYMBOL void evhttp_request_set_chunked_cb(struct evhttp_request *, void(*cb)(struct evhttp_request *, void *))
Enable delivery of chunks to requestor.
evhttp_connection_free
EVENT2_EXPORT_SYMBOL void evhttp_connection_free(struct evhttp_connection *evcon)
Frees an http connection.
evhttp_connection_base_new
EVENT2_EXPORT_SYMBOL struct evhttp_connection * evhttp_connection_base_new(struct event_base *base, struct evdns_base *dnsbase, const char *address, ev_uint16_t port)
Create and return a connection object that can be used to for making HTTP requests.
EVREQ_HTTP_DATA_TOO_LONG
@ EVREQ_HTTP_DATA_TOO_LONG
Body is greater then evhttp_connection_set_max_body_size()
Definition: http.h:791
evhttp_set_default_content_type
EVENT2_EXPORT_SYMBOL void evhttp_set_default_content_type(struct evhttp *http, const char *content_type)
Set the value to use for the Content-Type header when none was provided.
evhttp_uri_get_fragment
const EVENT2_EXPORT_SYMBOL char * evhttp_uri_get_fragment(const struct evhttp_uri *uri)
Return the fragment part of an evhttp_uri (excluding the leading "#"), or NULL if it has no fragment ...
evhttp_connection_get_peer
EVENT2_EXPORT_SYMBOL void evhttp_connection_get_peer(struct evhttp_connection *evcon, const char **address, ev_uint16_t *port)
Get the remote address and port associated with this connection.
evhttp_set_max_connections
EVENT2_EXPORT_SYMBOL void evhttp_set_max_connections(struct evhttp *http, int max_connections)
Set the maximum number of simultaneous connections for this server.
evhttp_add_header
EVENT2_EXPORT_SYMBOL int evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *value)
Adds a header to a list of existing headers.
evhttp_uri_set_flags
EVENT2_EXPORT_SYMBOL void evhttp_uri_set_flags(struct evhttp_uri *uri, unsigned flags)
Changes the flags set on a given URI.
evhttp_parse_query_str
EVENT2_EXPORT_SYMBOL int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers)
evhttp_send_error
EVENT2_EXPORT_SYMBOL void evhttp_send_error(struct evhttp_request *req, int error, const char *reason)
Send an HTML error message to the client.
EVREQ_HTTP_TIMEOUT
@ EVREQ_HTTP_TIMEOUT
Timeout reached, also.
Definition: http.h:771
evhttp_encode_uri
EVENT2_EXPORT_SYMBOL char * evhttp_encode_uri(const char *str)
Helper function to encode a string for inclusion in a URI.
evhttp_uri_set_unixsocket
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_unixsocket(struct evhttp_uri *uri, const char *unixsocket)
Set the unix socket of an evhttp_uri, or clear the unix socket if unixsocket==NULL.
evhttp_uridecode
EVENT2_EXPORT_SYMBOL char * evhttp_uridecode(const char *uri, int decode_plus, size_t *size_out)
Helper function to decode a URI-escaped string or HTTP parameter.
evhttp_cancel_request
EVENT2_EXPORT_SYMBOL void evhttp_cancel_request(struct evhttp_request *req)
Cancels a pending HTTP request.
evhttp_request_get_evhttp_uri
EVENT2_EXPORT_SYMBOL const struct evhttp_uri * evhttp_request_get_evhttp_uri(const struct evhttp_request *req)
Returns the request URI (parsed)
evhttp_uri_get_scheme
const EVENT2_EXPORT_SYMBOL char * evhttp_uri_get_scheme(const struct evhttp_uri *uri)
Return the scheme of an evhttp_uri, or NULL if there is no scheme has been set and the evhttp_uri con...
evhttp_uri_set_scheme
EVENT2_EXPORT_SYMBOL int evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme)
Set the scheme of an evhttp_uri, or clear the scheme if scheme==NULL.
evhttp_request_get_output_headers
EVENT2_EXPORT_SYMBOL struct evkeyvalq * evhttp_request_get_output_headers(struct evhttp_request *req)
Returns the output headers.
evhttp_find_header
const EVENT2_EXPORT_SYMBOL char * evhttp_find_header(const struct evkeyvalq *headers, const char *key)
Finds the value belonging to a header.
evhttp_request_get_connection
EVENT2_EXPORT_SYMBOL struct evhttp_connection * evhttp_request_get_connection(struct evhttp_request *req)
Returns the connection object associated with the request or NULL.
evhttp_set_gencb
EVENT2_EXPORT_SYMBOL void evhttp_set_gencb(struct evhttp *http, void(*cb)(struct evhttp_request *, void *), void *arg)
Set a callback for all requests that are not caught by specific callbacks.
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
evhttp_uriencode
EVENT2_EXPORT_SYMBOL char * evhttp_uriencode(const char *str, ev_ssize_t size, int space_to_plus)
As evhttp_encode_uri, but if 'size' is nonnegative, treat the string as being 'size' bytes long.
evhttp_set_ext_method_cmp
EVENT2_EXPORT_SYMBOL void evhttp_set_ext_method_cmp(struct evhttp *http, evhttp_ext_method_cb cmp)
Sets the callback function which allows HTTP extended methods to be supported by this server.
evhttp_bind_listener
EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket * evhttp_bind_listener(struct evhttp *http, struct evconnlistener *listener)
The most low-level evhttp_bind/accept method: takes an evconnlistener, and returns an evhttp_bound_so...
evhttp_send_reply_chunk_with_cb
EVENT2_EXPORT_SYMBOL void evhttp_send_reply_chunk_with_cb(struct evhttp_request *req, struct evbuffer *databuf, void(*cb)(struct evhttp_connection *, void *), void *arg)
Send another data chunk as part of an ongoing chunked reply.
evhttp_uri_get_host
const EVENT2_EXPORT_SYMBOL char * evhttp_uri_get_host(const struct evhttp_uri *uri)
Return the host part of an evhttp_uri, or NULL if it has no host set.
evhttp_htmlescape
EVENT2_EXPORT_SYMBOL char * evhttp_htmlescape(const char *html)
Escape HTML character entities in a string.
evhttp_accept_socket_with_handle
EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket * evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd)
Like evhttp_accept_socket(), but returns a handle for referencing the socket.
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition: util.h:325
evhttp_del_cb
EVENT2_EXPORT_SYMBOL int evhttp_del_cb(struct evhttp *, const char *)
Removes the callback for a specified URI.