mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
expose evhttp_accept_socket() api
svn:r787
This commit is contained in:
parent
6bd28951e7
commit
52a851389f
@ -11,6 +11,7 @@ Changes in 1.4.4-stable:
|
||||
o fix evhttp_bind_socket() so that multiple sockets can be bound by the same http server.
|
||||
o Build test directory correctly with CPPFLAGS set.
|
||||
o Fix build under Visual C++ 2005.
|
||||
o Expose evhttp_accept_socket() API.
|
||||
|
||||
Changes in 1.4.3-stable:
|
||||
o include Content-Length in reply for HTTP/1.0 requests with keep-alive
|
||||
|
18
evhttp.h
18
evhttp.h
@ -86,6 +86,24 @@ struct evhttp *evhttp_new(struct event_base *base);
|
||||
*/
|
||||
int evhttp_bind_socket(struct evhttp *http, const char *address, u_short port);
|
||||
|
||||
/**
|
||||
* Makes an HTTP server accept connections on the specified socket
|
||||
*
|
||||
* This may be useful to create a socket and then fork multiple instances
|
||||
* of an http server, or when a socket has been communicated via file
|
||||
* descriptor passing in situations where an http servers does not have
|
||||
* permissions to bind to a low-numbered port.
|
||||
*
|
||||
* Can be called multiple times to have the http server listen to
|
||||
* multiple different sockets.
|
||||
*
|
||||
* @param http a pointer to an evhttp object
|
||||
* @param fd a socket fd that is ready for accepting connections
|
||||
* @return 0 on success, -1 on failure.
|
||||
* @see evhttp_free(), evhttp_bind_socket()
|
||||
*/
|
||||
int evhttp_accept_socket(struct evhttp *http, int fd);
|
||||
|
||||
/**
|
||||
* Free the previously created HTTP server.
|
||||
*
|
||||
|
3
http.c
3
http.c
@ -162,7 +162,6 @@ static void evhttp_connection_start_detectclose(
|
||||
static void evhttp_connection_stop_detectclose(
|
||||
struct evhttp_connection *evcon);
|
||||
static void evhttp_request_dispatch(struct evhttp_connection* evcon);
|
||||
static int evhttp_accept_socket(struct evhttp *http, int fd);
|
||||
|
||||
void evhttp_read(int, short, void *);
|
||||
void evhttp_write(int, short, void *);
|
||||
@ -2021,7 +2020,7 @@ evhttp_bind_socket(struct evhttp *http, const char *address, u_short port)
|
||||
return (res);
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
evhttp_accept_socket(struct evhttp *http, int fd)
|
||||
{
|
||||
struct evhttp_bound_socket *bound;
|
||||
|
Loading…
x
Reference in New Issue
Block a user