[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] Small patch for grabbing underlying event_base from an evhttp_request
Greetings,
Attached is a small patch which allows a user to grab the underlying
event_base from an evhttp_request. I have patched this against the
current master on github.
If there is a better way to do this, I am open to suggestions.
Thanks in advance!
http.c | 9 +++++++++
include/event2/http.h | 5 +++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index 19d4f91..4938368 100644
--- a/http.c
+++ b/http.c
@@ -2978,6 +2978,15 @@ evhttp_request_get_connection(struct evhttp_request *req)
return req->evcon;
}
+struct event_base *
+evhttp_request_get_base(struct evhttp_request *req)
+{
+ struct evhttp_connection *connection;
+
+ connection = evhttp_request_get_connection(req);
+
+ return connection->base;
+}
void
evhttp_request_set_chunked_cb(struct evhttp_request *req,
diff --git a/include/event2/http.h b/include/event2/http.h
index cab068a..9bdca4d 100644
--- a/include/event2/http.h
+++ b/include/event2/http.h
@@ -383,6 +383,11 @@ int evhttp_request_is_owned(struct evhttp_request *req);
*/
struct evhttp_connection *evhttp_request_get_connection(struct evhttp_request *req);
+/**
+ * Returns the underlying event_base for this request
+ */
+struct event_base *evhttp_request_get_base(struct evhttp_request *req);
+
void evhttp_connection_set_max_headers_size(struct evhttp_connection *evcon,
ev_ssize_t new_max_headers_size);
--
1.7.0.4