Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/event2
File: http.h
/*
[0] Fix | Delete
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
[1] Fix | Delete
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
[2] Fix | Delete
*
[3] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[4] Fix | Delete
* modification, are permitted provided that the following conditions
[5] Fix | Delete
* are met:
[6] Fix | Delete
* 1. Redistributions of source code must retain the above copyright
[7] Fix | Delete
* notice, this list of conditions and the following disclaimer.
[8] Fix | Delete
* 2. Redistributions in binary form must reproduce the above copyright
[9] Fix | Delete
* notice, this list of conditions and the following disclaimer in the
[10] Fix | Delete
* documentation and/or other materials provided with the distribution.
[11] Fix | Delete
* 3. The name of the author may not be used to endorse or promote products
[12] Fix | Delete
* derived from this software without specific prior written permission.
[13] Fix | Delete
*
[14] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
[15] Fix | Delete
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
[16] Fix | Delete
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
[17] Fix | Delete
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
[18] Fix | Delete
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
[19] Fix | Delete
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
[20] Fix | Delete
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
[21] Fix | Delete
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
[22] Fix | Delete
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
[23] Fix | Delete
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[24] Fix | Delete
*/
[25] Fix | Delete
#ifndef EVENT2_HTTP_H_INCLUDED_
[26] Fix | Delete
#define EVENT2_HTTP_H_INCLUDED_
[27] Fix | Delete
[28] Fix | Delete
/* For int types. */
[29] Fix | Delete
#include <event2/util.h>
[30] Fix | Delete
#include <event2/visibility.h>
[31] Fix | Delete
[32] Fix | Delete
#ifdef __cplusplus
[33] Fix | Delete
extern "C" {
[34] Fix | Delete
#endif
[35] Fix | Delete
[36] Fix | Delete
/* In case we haven't included the right headers yet. */
[37] Fix | Delete
struct evbuffer;
[38] Fix | Delete
struct event_base;
[39] Fix | Delete
struct bufferevent;
[40] Fix | Delete
struct evhttp_connection;
[41] Fix | Delete
[42] Fix | Delete
/** @file event2/http.h
[43] Fix | Delete
*
[44] Fix | Delete
* Basic support for HTTP serving.
[45] Fix | Delete
*
[46] Fix | Delete
* As Libevent is a library for dealing with event notification and most
[47] Fix | Delete
* interesting applications are networked today, I have often found the
[48] Fix | Delete
* need to write HTTP code. The following prototypes and definitions provide
[49] Fix | Delete
* an application with a minimal interface for making HTTP requests and for
[50] Fix | Delete
* creating a very simple HTTP server.
[51] Fix | Delete
*/
[52] Fix | Delete
[53] Fix | Delete
/* Response codes */
[54] Fix | Delete
#define HTTP_OK 200 /**< request completed ok */
[55] Fix | Delete
#define HTTP_NOCONTENT 204 /**< request does not have content */
[56] Fix | Delete
#define HTTP_MOVEPERM 301 /**< the uri moved permanently */
[57] Fix | Delete
#define HTTP_MOVETEMP 302 /**< the uri moved temporarily */
[58] Fix | Delete
#define HTTP_NOTMODIFIED 304 /**< page was not modified from last */
[59] Fix | Delete
#define HTTP_BADREQUEST 400 /**< invalid http request was made */
[60] Fix | Delete
#define HTTP_NOTFOUND 404 /**< could not find content for uri */
[61] Fix | Delete
#define HTTP_BADMETHOD 405 /**< method not allowed for this uri */
[62] Fix | Delete
#define HTTP_ENTITYTOOLARGE 413 /**< */
[63] Fix | Delete
#define HTTP_EXPECTATIONFAILED 417 /**< we can't handle this expectation */
[64] Fix | Delete
#define HTTP_INTERNAL 500 /**< internal error */
[65] Fix | Delete
#define HTTP_NOTIMPLEMENTED 501 /**< not implemented */
[66] Fix | Delete
#define HTTP_SERVUNAVAIL 503 /**< the server is not available */
[67] Fix | Delete
[68] Fix | Delete
struct evhttp;
[69] Fix | Delete
struct evhttp_request;
[70] Fix | Delete
struct evkeyvalq;
[71] Fix | Delete
struct evhttp_bound_socket;
[72] Fix | Delete
struct evconnlistener;
[73] Fix | Delete
struct evdns_base;
[74] Fix | Delete
[75] Fix | Delete
/**
[76] Fix | Delete
* Create a new HTTP server.
[77] Fix | Delete
*
[78] Fix | Delete
* @param base (optional) the event base to receive the HTTP events
[79] Fix | Delete
* @return a pointer to a newly initialized evhttp server structure
[80] Fix | Delete
* @see evhttp_free()
[81] Fix | Delete
*/
[82] Fix | Delete
EVENT2_EXPORT_SYMBOL
[83] Fix | Delete
struct evhttp *evhttp_new(struct event_base *base);
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* Binds an HTTP server on the specified address and port.
[87] Fix | Delete
*
[88] Fix | Delete
* Can be called multiple times to bind the same http server
[89] Fix | Delete
* to multiple different ports.
[90] Fix | Delete
*
[91] Fix | Delete
* @param http a pointer to an evhttp object
[92] Fix | Delete
* @param address a string containing the IP address to listen(2) on
[93] Fix | Delete
* @param port the port number to listen on
[94] Fix | Delete
* @return 0 on success, -1 on failure.
[95] Fix | Delete
* @see evhttp_accept_socket()
[96] Fix | Delete
*/
[97] Fix | Delete
EVENT2_EXPORT_SYMBOL
[98] Fix | Delete
int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port);
[99] Fix | Delete
[100] Fix | Delete
/**
[101] Fix | Delete
* Like evhttp_bind_socket(), but returns a handle for referencing the socket.
[102] Fix | Delete
*
[103] Fix | Delete
* The returned pointer is not valid after \a http is freed.
[104] Fix | Delete
*
[105] Fix | Delete
* @param http a pointer to an evhttp object
[106] Fix | Delete
* @param address a string containing the IP address to listen(2) on
[107] Fix | Delete
* @param port the port number to listen on
[108] Fix | Delete
* @return Handle for the socket on success, NULL on failure.
[109] Fix | Delete
* @see evhttp_bind_socket(), evhttp_del_accept_socket()
[110] Fix | Delete
*/
[111] Fix | Delete
EVENT2_EXPORT_SYMBOL
[112] Fix | Delete
struct evhttp_bound_socket *evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t port);
[113] Fix | Delete
[114] Fix | Delete
/**
[115] Fix | Delete
* Makes an HTTP server accept connections on the specified socket.
[116] Fix | Delete
*
[117] Fix | Delete
* This may be useful to create a socket and then fork multiple instances
[118] Fix | Delete
* of an http server, or when a socket has been communicated via file
[119] Fix | Delete
* descriptor passing in situations where an http servers does not have
[120] Fix | Delete
* permissions to bind to a low-numbered port.
[121] Fix | Delete
*
[122] Fix | Delete
* Can be called multiple times to have the http server listen to
[123] Fix | Delete
* multiple different sockets.
[124] Fix | Delete
*
[125] Fix | Delete
* @param http a pointer to an evhttp object
[126] Fix | Delete
* @param fd a socket fd that is ready for accepting connections
[127] Fix | Delete
* @return 0 on success, -1 on failure.
[128] Fix | Delete
* @see evhttp_bind_socket()
[129] Fix | Delete
*/
[130] Fix | Delete
EVENT2_EXPORT_SYMBOL
[131] Fix | Delete
int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
[132] Fix | Delete
[133] Fix | Delete
/**
[134] Fix | Delete
* Like evhttp_accept_socket(), but returns a handle for referencing the socket.
[135] Fix | Delete
*
[136] Fix | Delete
* The returned pointer is not valid after \a http is freed.
[137] Fix | Delete
*
[138] Fix | Delete
* @param http a pointer to an evhttp object
[139] Fix | Delete
* @param fd a socket fd that is ready for accepting connections
[140] Fix | Delete
* @return Handle for the socket on success, NULL on failure.
[141] Fix | Delete
* @see evhttp_accept_socket(), evhttp_del_accept_socket()
[142] Fix | Delete
*/
[143] Fix | Delete
EVENT2_EXPORT_SYMBOL
[144] Fix | Delete
struct evhttp_bound_socket *evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd);
[145] Fix | Delete
[146] Fix | Delete
/**
[147] Fix | Delete
* The most low-level evhttp_bind/accept method: takes an evconnlistener, and
[148] Fix | Delete
* returns an evhttp_bound_socket. The listener will be freed when the bound
[149] Fix | Delete
* socket is freed.
[150] Fix | Delete
*/
[151] Fix | Delete
EVENT2_EXPORT_SYMBOL
[152] Fix | Delete
struct evhttp_bound_socket *evhttp_bind_listener(struct evhttp *http, struct evconnlistener *listener);
[153] Fix | Delete
[154] Fix | Delete
/**
[155] Fix | Delete
* Return the listener used to implement a bound socket.
[156] Fix | Delete
*/
[157] Fix | Delete
EVENT2_EXPORT_SYMBOL
[158] Fix | Delete
struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound_socket *bound);
[159] Fix | Delete
[160] Fix | Delete
typedef void evhttp_bound_socket_foreach_fn(struct evhttp_bound_socket *, void *);
[161] Fix | Delete
/**
[162] Fix | Delete
* Applies the function specified in the first argument to all
[163] Fix | Delete
* evhttp_bound_sockets associated with "http". The user must not
[164] Fix | Delete
* attempt to free or remove any connections, sockets or listeners
[165] Fix | Delete
* in the callback "function".
[166] Fix | Delete
*
[167] Fix | Delete
* @param http pointer to an evhttp object
[168] Fix | Delete
* @param function function to apply to every bound socket
[169] Fix | Delete
* @param argument pointer value passed to function for every socket iterated
[170] Fix | Delete
*/
[171] Fix | Delete
EVENT2_EXPORT_SYMBOL
[172] Fix | Delete
void evhttp_foreach_bound_socket(struct evhttp *http, evhttp_bound_socket_foreach_fn *function, void *argument);
[173] Fix | Delete
[174] Fix | Delete
/**
[175] Fix | Delete
* Makes an HTTP server stop accepting connections on the specified socket
[176] Fix | Delete
*
[177] Fix | Delete
* This may be useful when a socket has been sent via file descriptor passing
[178] Fix | Delete
* and is no longer needed by the current process.
[179] Fix | Delete
*
[180] Fix | Delete
* If you created this bound socket with evhttp_bind_socket_with_handle or
[181] Fix | Delete
* evhttp_accept_socket_with_handle, this function closes the fd you provided.
[182] Fix | Delete
* If you created this bound socket with evhttp_bind_listener, this function
[183] Fix | Delete
* frees the listener you provided.
[184] Fix | Delete
*
[185] Fix | Delete
* \a bound_socket is an invalid pointer after this call returns.
[186] Fix | Delete
*
[187] Fix | Delete
* @param http a pointer to an evhttp object
[188] Fix | Delete
* @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
[189] Fix | Delete
* @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
[190] Fix | Delete
*/
[191] Fix | Delete
EVENT2_EXPORT_SYMBOL
[192] Fix | Delete
void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound_socket);
[193] Fix | Delete
[194] Fix | Delete
/**
[195] Fix | Delete
* Get the raw file descriptor referenced by an evhttp_bound_socket.
[196] Fix | Delete
*
[197] Fix | Delete
* @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
[198] Fix | Delete
* @return the file descriptor used by the bound socket
[199] Fix | Delete
* @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
[200] Fix | Delete
*/
[201] Fix | Delete
EVENT2_EXPORT_SYMBOL
[202] Fix | Delete
evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket);
[203] Fix | Delete
[204] Fix | Delete
/**
[205] Fix | Delete
* Free the previously created HTTP server.
[206] Fix | Delete
*
[207] Fix | Delete
* Works only if no requests are currently being served.
[208] Fix | Delete
*
[209] Fix | Delete
* @param http the evhttp server object to be freed
[210] Fix | Delete
* @see evhttp_start()
[211] Fix | Delete
*/
[212] Fix | Delete
EVENT2_EXPORT_SYMBOL
[213] Fix | Delete
void evhttp_free(struct evhttp* http);
[214] Fix | Delete
[215] Fix | Delete
/** XXX Document. */
[216] Fix | Delete
EVENT2_EXPORT_SYMBOL
[217] Fix | Delete
void evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_headers_size);
[218] Fix | Delete
/** XXX Document. */
[219] Fix | Delete
EVENT2_EXPORT_SYMBOL
[220] Fix | Delete
void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size);
[221] Fix | Delete
[222] Fix | Delete
/**
[223] Fix | Delete
Set the value to use for the Content-Type header when none was provided. If
[224] Fix | Delete
the content type string is NULL, the Content-Type header will not be
[225] Fix | Delete
automatically added.
[226] Fix | Delete
[227] Fix | Delete
@param http the http server on which to set the default content type
[228] Fix | Delete
@param content_type the value for the Content-Type header
[229] Fix | Delete
*/
[230] Fix | Delete
EVENT2_EXPORT_SYMBOL
[231] Fix | Delete
void evhttp_set_default_content_type(struct evhttp *http,
[232] Fix | Delete
const char *content_type);
[233] Fix | Delete
[234] Fix | Delete
/**
[235] Fix | Delete
Sets the what HTTP methods are supported in requests accepted by this
[236] Fix | Delete
server, and passed to user callbacks.
[237] Fix | Delete
[238] Fix | Delete
If not supported they will generate a "405 Method not allowed" response.
[239] Fix | Delete
[240] Fix | Delete
By default this includes the following methods: GET, POST, HEAD, PUT, DELETE
[241] Fix | Delete
[242] Fix | Delete
@param http the http server on which to set the methods
[243] Fix | Delete
@param methods bit mask constructed from evhttp_cmd_type values
[244] Fix | Delete
*/
[245] Fix | Delete
EVENT2_EXPORT_SYMBOL
[246] Fix | Delete
void evhttp_set_allowed_methods(struct evhttp* http, ev_uint16_t methods);
[247] Fix | Delete
[248] Fix | Delete
/**
[249] Fix | Delete
Set a callback for a specified URI
[250] Fix | Delete
[251] Fix | Delete
@param http the http sever on which to set the callback
[252] Fix | Delete
@param path the path for which to invoke the callback
[253] Fix | Delete
@param cb the callback function that gets invoked on requesting path
[254] Fix | Delete
@param cb_arg an additional context argument for the callback
[255] Fix | Delete
@return 0 on success, -1 if the callback existed already, -2 on failure
[256] Fix | Delete
*/
[257] Fix | Delete
EVENT2_EXPORT_SYMBOL
[258] Fix | Delete
int evhttp_set_cb(struct evhttp *http, const char *path,
[259] Fix | Delete
void (*cb)(struct evhttp_request *, void *), void *cb_arg);
[260] Fix | Delete
[261] Fix | Delete
/** Removes the callback for a specified URI */
[262] Fix | Delete
EVENT2_EXPORT_SYMBOL
[263] Fix | Delete
int evhttp_del_cb(struct evhttp *, const char *);
[264] Fix | Delete
[265] Fix | Delete
/**
[266] Fix | Delete
Set a callback for all requests that are not caught by specific callbacks
[267] Fix | Delete
[268] Fix | Delete
Invokes the specified callback for all requests that do not match any of
[269] Fix | Delete
the previously specified request paths. This is catchall for requests not
[270] Fix | Delete
specifically configured with evhttp_set_cb().
[271] Fix | Delete
[272] Fix | Delete
@param http the evhttp server object for which to set the callback
[273] Fix | Delete
@param cb the callback to invoke for any unmatched requests
[274] Fix | Delete
@param arg an context argument for the callback
[275] Fix | Delete
*/
[276] Fix | Delete
EVENT2_EXPORT_SYMBOL
[277] Fix | Delete
void evhttp_set_gencb(struct evhttp *http,
[278] Fix | Delete
void (*cb)(struct evhttp_request *, void *), void *arg);
[279] Fix | Delete
[280] Fix | Delete
/**
[281] Fix | Delete
Set a callback used to create new bufferevents for connections
[282] Fix | Delete
to a given evhttp object.
[283] Fix | Delete
[284] Fix | Delete
You can use this to override the default bufferevent type -- for example,
[285] Fix | Delete
to make this evhttp object use SSL bufferevents rather than unencrypted
[286] Fix | Delete
ones.
[287] Fix | Delete
[288] Fix | Delete
New bufferevents must be allocated with no fd set on them.
[289] Fix | Delete
[290] Fix | Delete
@param http the evhttp server object for which to set the callback
[291] Fix | Delete
@param cb the callback to invoke for incoming connections
[292] Fix | Delete
@param arg an context argument for the callback
[293] Fix | Delete
*/
[294] Fix | Delete
EVENT2_EXPORT_SYMBOL
[295] Fix | Delete
void evhttp_set_bevcb(struct evhttp *http,
[296] Fix | Delete
struct bufferevent *(*cb)(struct event_base *, void *), void *arg);
[297] Fix | Delete
[298] Fix | Delete
/**
[299] Fix | Delete
Adds a virtual host to the http server.
[300] Fix | Delete
[301] Fix | Delete
A virtual host is a newly initialized evhttp object that has request
[302] Fix | Delete
callbacks set on it via evhttp_set_cb() or evhttp_set_gencb(). It
[303] Fix | Delete
most not have any listing sockets associated with it.
[304] Fix | Delete
[305] Fix | Delete
If the virtual host has not been removed by the time that evhttp_free()
[306] Fix | Delete
is called on the main http server, it will be automatically freed, too.
[307] Fix | Delete
[308] Fix | Delete
It is possible to have hierarchical vhosts. For example: A vhost
[309] Fix | Delete
with the pattern *.example.com may have other vhosts with patterns
[310] Fix | Delete
foo.example.com and bar.example.com associated with it.
[311] Fix | Delete
[312] Fix | Delete
@param http the evhttp object to which to add a virtual host
[313] Fix | Delete
@param pattern the glob pattern against which the hostname is matched.
[314] Fix | Delete
The match is case insensitive and follows otherwise regular shell
[315] Fix | Delete
matching.
[316] Fix | Delete
@param vhost the virtual host to add the regular http server.
[317] Fix | Delete
@return 0 on success, -1 on failure
[318] Fix | Delete
@see evhttp_remove_virtual_host()
[319] Fix | Delete
*/
[320] Fix | Delete
EVENT2_EXPORT_SYMBOL
[321] Fix | Delete
int evhttp_add_virtual_host(struct evhttp* http, const char *pattern,
[322] Fix | Delete
struct evhttp* vhost);
[323] Fix | Delete
[324] Fix | Delete
/**
[325] Fix | Delete
Removes a virtual host from the http server.
[326] Fix | Delete
[327] Fix | Delete
@param http the evhttp object from which to remove the virtual host
[328] Fix | Delete
@param vhost the virtual host to remove from the regular http server.
[329] Fix | Delete
@return 0 on success, -1 on failure
[330] Fix | Delete
@see evhttp_add_virtual_host()
[331] Fix | Delete
*/
[332] Fix | Delete
EVENT2_EXPORT_SYMBOL
[333] Fix | Delete
int evhttp_remove_virtual_host(struct evhttp* http, struct evhttp* vhost);
[334] Fix | Delete
[335] Fix | Delete
/**
[336] Fix | Delete
Add a server alias to an http object. The http object can be a virtual
[337] Fix | Delete
host or the main server.
[338] Fix | Delete
[339] Fix | Delete
@param http the evhttp object
[340] Fix | Delete
@param alias the alias to add
[341] Fix | Delete
@see evhttp_add_remove_alias()
[342] Fix | Delete
*/
[343] Fix | Delete
EVENT2_EXPORT_SYMBOL
[344] Fix | Delete
int evhttp_add_server_alias(struct evhttp *http, const char *alias);
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
Remove a server alias from an http object.
[348] Fix | Delete
[349] Fix | Delete
@param http the evhttp object
[350] Fix | Delete
@param alias the alias to remove
[351] Fix | Delete
@see evhttp_add_server_alias()
[352] Fix | Delete
*/
[353] Fix | Delete
EVENT2_EXPORT_SYMBOL
[354] Fix | Delete
int evhttp_remove_server_alias(struct evhttp *http, const char *alias);
[355] Fix | Delete
[356] Fix | Delete
/**
[357] Fix | Delete
* Set the timeout for an HTTP request.
[358] Fix | Delete
*
[359] Fix | Delete
* @param http an evhttp object
[360] Fix | Delete
* @param timeout_in_secs the timeout, in seconds
[361] Fix | Delete
*/
[362] Fix | Delete
EVENT2_EXPORT_SYMBOL
[363] Fix | Delete
void evhttp_set_timeout(struct evhttp *http, int timeout_in_secs);
[364] Fix | Delete
[365] Fix | Delete
/**
[366] Fix | Delete
* Set the timeout for an HTTP request.
[367] Fix | Delete
*
[368] Fix | Delete
* @param http an evhttp object
[369] Fix | Delete
* @param tv the timeout, or NULL
[370] Fix | Delete
*/
[371] Fix | Delete
EVENT2_EXPORT_SYMBOL
[372] Fix | Delete
void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval* tv);
[373] Fix | Delete
[374] Fix | Delete
/* Read all the clients body, and only after this respond with an error if the
[375] Fix | Delete
* clients body exceed max_body_size */
[376] Fix | Delete
#define EVHTTP_SERVER_LINGERING_CLOSE 0x0001
[377] Fix | Delete
/**
[378] Fix | Delete
* Set connection flags for HTTP server.
[379] Fix | Delete
*
[380] Fix | Delete
* @see EVHTTP_SERVER_*
[381] Fix | Delete
* @return 0 on success, otherwise non zero (for example if flag doesn't
[382] Fix | Delete
* supported).
[383] Fix | Delete
*/
[384] Fix | Delete
EVENT2_EXPORT_SYMBOL
[385] Fix | Delete
int evhttp_set_flags(struct evhttp *http, int flags);
[386] Fix | Delete
[387] Fix | Delete
/* Request/Response functionality */
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Send an HTML error message to the client.
[391] Fix | Delete
*
[392] Fix | Delete
* @param req a request object
[393] Fix | Delete
* @param error the HTTP error code
[394] Fix | Delete
* @param reason a brief explanation of the error. If this is NULL, we'll
[395] Fix | Delete
* just use the standard meaning of the error code.
[396] Fix | Delete
*/
[397] Fix | Delete
EVENT2_EXPORT_SYMBOL
[398] Fix | Delete
void evhttp_send_error(struct evhttp_request *req, int error,
[399] Fix | Delete
const char *reason);
[400] Fix | Delete
[401] Fix | Delete
/**
[402] Fix | Delete
* Send an HTML reply to the client.
[403] Fix | Delete
*
[404] Fix | Delete
* The body of the reply consists of the data in databuf. After calling
[405] Fix | Delete
* evhttp_send_reply() databuf will be empty, but the buffer is still
[406] Fix | Delete
* owned by the caller and needs to be deallocated by the caller if
[407] Fix | Delete
* necessary.
[408] Fix | Delete
*
[409] Fix | Delete
* @param req a request object
[410] Fix | Delete
* @param code the HTTP response code to send
[411] Fix | Delete
* @param reason a brief message to send with the response code
[412] Fix | Delete
* @param databuf the body of the response
[413] Fix | Delete
*/
[414] Fix | Delete
EVENT2_EXPORT_SYMBOL
[415] Fix | Delete
void evhttp_send_reply(struct evhttp_request *req, int code,
[416] Fix | Delete
const char *reason, struct evbuffer *databuf);
[417] Fix | Delete
[418] Fix | Delete
/* Low-level response interface, for streaming/chunked replies */
[419] Fix | Delete
[420] Fix | Delete
/**
[421] Fix | Delete
Initiate a reply that uses Transfer-Encoding chunked.
[422] Fix | Delete
[423] Fix | Delete
This allows the caller to stream the reply back to the client and is
[424] Fix | Delete
useful when either not all of the reply data is immediately available
[425] Fix | Delete
or when sending very large replies.
[426] Fix | Delete
[427] Fix | Delete
The caller needs to supply data chunks with evhttp_send_reply_chunk()
[428] Fix | Delete
and complete the reply by calling evhttp_send_reply_end().
[429] Fix | Delete
[430] Fix | Delete
@param req a request object
[431] Fix | Delete
@param code the HTTP response code to send
[432] Fix | Delete
@param reason a brief message to send with the response code
[433] Fix | Delete
*/
[434] Fix | Delete
EVENT2_EXPORT_SYMBOL
[435] Fix | Delete
void evhttp_send_reply_start(struct evhttp_request *req, int code,
[436] Fix | Delete
const char *reason);
[437] Fix | Delete
[438] Fix | Delete
/**
[439] Fix | Delete
Send another data chunk as part of an ongoing chunked reply.
[440] Fix | Delete
[441] Fix | Delete
The reply chunk consists of the data in databuf. After calling
[442] Fix | Delete
evhttp_send_reply_chunk() databuf will be empty, but the buffer is
[443] Fix | Delete
still owned by the caller and needs to be deallocated by the caller
[444] Fix | Delete
if necessary.
[445] Fix | Delete
[446] Fix | Delete
@param req a request object
[447] Fix | Delete
@param databuf the data chunk to send as part of the reply.
[448] Fix | Delete
*/
[449] Fix | Delete
EVENT2_EXPORT_SYMBOL
[450] Fix | Delete
void evhttp_send_reply_chunk(struct evhttp_request *req,
[451] Fix | Delete
struct evbuffer *databuf);
[452] Fix | Delete
[453] Fix | Delete
/**
[454] Fix | Delete
Send another data chunk as part of an ongoing chunked reply.
[455] Fix | Delete
[456] Fix | Delete
The reply chunk consists of the data in databuf. After calling
[457] Fix | Delete
evhttp_send_reply_chunk() databuf will be empty, but the buffer is
[458] Fix | Delete
still owned by the caller and needs to be deallocated by the caller
[459] Fix | Delete
if necessary.
[460] Fix | Delete
[461] Fix | Delete
@param req a request object
[462] Fix | Delete
@param databuf the data chunk to send as part of the reply.
[463] Fix | Delete
@param cb callback funcion
[464] Fix | Delete
@param call back's argument.
[465] Fix | Delete
*/
[466] Fix | Delete
EVENT2_EXPORT_SYMBOL
[467] Fix | Delete
void evhttp_send_reply_chunk_with_cb(struct evhttp_request *, struct evbuffer *,
[468] Fix | Delete
void (*cb)(struct evhttp_connection *, void *), void *arg);
[469] Fix | Delete
[470] Fix | Delete
/**
[471] Fix | Delete
Complete a chunked reply, freeing the request as appropriate.
[472] Fix | Delete
[473] Fix | Delete
@param req a request object
[474] Fix | Delete
*/
[475] Fix | Delete
EVENT2_EXPORT_SYMBOL
[476] Fix | Delete
void evhttp_send_reply_end(struct evhttp_request *req);
[477] Fix | Delete
[478] Fix | Delete
/*
[479] Fix | Delete
* Interfaces for making requests
[480] Fix | Delete
*/
[481] Fix | Delete
[482] Fix | Delete
/** The different request types supported by evhttp. These are as specified
[483] Fix | Delete
* in RFC2616, except for PATCH which is specified by RFC5789.
[484] Fix | Delete
*
[485] Fix | Delete
* By default, only some of these methods are accepted and passed to user
[486] Fix | Delete
* callbacks; use evhttp_set_allowed_methods() to change which methods
[487] Fix | Delete
* are allowed.
[488] Fix | Delete
*/
[489] Fix | Delete
enum evhttp_cmd_type {
[490] Fix | Delete
EVHTTP_REQ_GET = 1 << 0,
[491] Fix | Delete
EVHTTP_REQ_POST = 1 << 1,
[492] Fix | Delete
EVHTTP_REQ_HEAD = 1 << 2,
[493] Fix | Delete
EVHTTP_REQ_PUT = 1 << 3,
[494] Fix | Delete
EVHTTP_REQ_DELETE = 1 << 4,
[495] Fix | Delete
EVHTTP_REQ_OPTIONS = 1 << 5,
[496] Fix | Delete
EVHTTP_REQ_TRACE = 1 << 6,
[497] Fix | Delete
EVHTTP_REQ_CONNECT = 1 << 7,
[498] Fix | Delete
EVHTTP_REQ_PATCH = 1 << 8
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function