Merge remote branch 'origin/patches-2.0'

This commit is contained in:
Nick Mathewson 2011-02-21 23:27:23 -05:00
commit 8f5cca47dd
5 changed files with 19 additions and 9 deletions

View File

@ -337,10 +337,14 @@ evport_dispatch(struct event_base *base, struct timeval *tv)
* (because we have to pass this to the callback)
*/
res = 0;
if (pevt->portev_events & POLLIN)
res |= EV_READ;
if (pevt->portev_events & POLLOUT)
res |= EV_WRITE;
if (pevt->portev_events & (POLLERR|POLLHUP)) {
res = EV_READ | EV_WRITE;
} else {
if (pevt->portev_events & POLLIN)
res |= EV_READ;
if (pevt->portev_events & POLLOUT)
res |= EV_WRITE;
}
/*
* Check for the error situations or a hangup situation

4
http.c
View File

@ -949,7 +949,9 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
evbuffer_remove_buffer(buf, req->input_buffer, n);
}
if (req->body_size > req->evcon->max_body_size) {
if (req->body_size > req->evcon->max_body_size ||
(!req->chunked && req->ntoread >= 0 &&
(size_t)req->ntoread > req->evcon->max_body_size)) {
/* failed body length test */
event_debug(("Request body is too long"));
evhttp_connection_fail(evcon,

View File

@ -748,8 +748,9 @@ const struct timeval *event_base_init_common_timeout(struct event_base *base,
Note that all memory returned from Libevent will be allocated by the
replacement functions rather than by malloc() and realloc(). Thus, if you
have replaced those functions, it may not be appropriate to free() memory
that you get from Libevent.
have replaced those functions, it will not be appropriate to free() memory
that you get from Libevent. Instead, you must use the free_fn replacement
that you provided.
@param malloc_fn A replacement for malloc.
@param realloc_fn A replacement for realloc

View File

@ -154,7 +154,10 @@ struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound_sock
* This may be useful when a socket has been sent via file descriptor passing
* and is no longer needed by the current process.
*
* This function does not close the socket.
* If you created this bound socket with evhttp_bind_socket_with_handle or
* evhttp_accept_socket_with_handle, this function closes the fd you provided.
* If you created this bound socket with evhttp_bind_listener, this function
* frees the listener you provided.
*
* \a bound_socket is an invalid pointer after this call returns.
*

View File

@ -75,7 +75,7 @@ What's New In Libevent 2.0 so far:
evutil.h) will continue to work by including the corresponding new
headers. Old code should not be broken by this change.
2.2. New thread-safe, binary-compatibile, harder-to-mess-up APIs
2.2. New thread-safe, binary-compatible, harder-to-mess-up APIs
Some aspects of the historical Libevent API have encouraged
non-threadsafe code, or forced code built against one version of Libevent