Discussion:
evhttp_request_own
(too old to reply)
Vincent Bernat
2014-02-10 20:20:56 UTC
Permalink
Raw Message
Hi!

I have a hard time to understand how `evhttp_request_own()` should be
used. I am trying to implement a websocket entry point. Therefore, once
I have parsed the request headers, I call `evhttp_request_own()` and I
do the upgrade myself. When I don't need the request anymore, I use
`evhttp_request_free()`.

However, when the connection is closed, I see that
`evhttp_request_free()` is called again. So, it seems I just don't need
to own the request and can just do whatever I want with it and not free
it myself? I already modify the callbacks to put my own.

The documentation is not quite clear on this.
--
Write clearly - don't sacrifice clarity for "efficiency".
- The Elements of Programming Style (Kernighan & Plauger)
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.
Vincent Bernat
2014-02-10 21:58:49 UTC
Permalink
Raw Message
Post by Vincent Bernat
I have a hard time to understand how `evhttp_request_own()` should be
used. I am trying to implement a websocket entry point. Therefore, once
I have parsed the request headers, I call `evhttp_request_own()` and I
do the upgrade myself. When I don't need the request anymore, I use
`evhttp_request_free()`.
However, when the connection is closed, I see that
`evhttp_request_free()` is called again. So, it seems I just don't need
to own the request and can just do whatever I want with it and not free
it myself? I already modify the callbacks to put my own.
Using `evhttp_connection_free()` seems to works better for me.
--
Each module should do one thing well.
- The Elements of Programming Style (Kernighan & Plauger)
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.
Loading...