[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] intercept http accept?



On Mon, May 12, 2014 at 12:23:42PM -0700, Scott Dorr wrote:
> In libevent 2.0.21, I'm not seeing a way to get a callback triggered on accept of an http connection.  Looking through the libevent code, I don't see a way to do that, either -- or I'm missing it completely. :)
> 
> Is there a way to get a callback triggered on accept of an http connection using the evhttp API?  Or is having your callback triggered post/accept/read/parse the only option? (other than using the generic libevent API to accept TCP network events and then slide over to using the http helper funcs after the fact)
> 
> Thanks!

If you use libevhtp you can set the following callbacks for pre and post
accept:

void evhtp_set_pre_accept_cb(evhtp_t * htp, evhtp_pre_accept_cb cb, void * arg);
void evhtp_set_post_accept_cb(evhtp_t * htp, evhtp_post_accept_cb cb, void * arg);

https://github.com/ellzey/libevhtp

And I urge others to start testing evhtp2: https://github.com/ellzey/libevhtp/tree/libevhtp2
This is the final step before getting merged into libevent.

(psst, websocket support)
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.