diff options
-rw-r--r-- | evport.c | 12 | ||||
-rw-r--r-- | http.c | 4 | ||||
-rw-r--r-- | include/event2/event.h | 5 | ||||
-rw-r--r-- | include/event2/http.h | 5 | ||||
-rw-r--r-- | whatsnew-2.0.txt | 2 |
5 files changed, 19 insertions, 9 deletions
@@ -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 @@ -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, diff --git a/include/event2/event.h b/include/event2/event.h index 4b05b325..5a3bbf32 100644 --- a/include/event2/event.h +++ b/include/event2/event.h @@ -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 diff --git a/include/event2/http.h b/include/event2/http.h index e05c3bff..4ffa7ac6 100644 --- a/include/event2/http.h +++ b/include/event2/http.h @@ -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. * diff --git a/whatsnew-2.0.txt b/whatsnew-2.0.txt index 3b4cfbdb..5ad6b979 100644 --- a/whatsnew-2.0.txt +++ b/whatsnew-2.0.txt @@ -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 |