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

[Libevent-users] howto proxy http conn using evhttp?



Hello ALL!

I'm new in libevent.
Now I try to make trivial http-proxy, and start from http-server.c sample, because I wish to use evhttp stack.

I rewrite general callback function.
When I get conn from client side, callback function called, ot's ok.
Then I need to establish connection to remote host from this callback, get an answer and pass it back to local client.

Here I need a help how to do this.
I guess than one quick way is to duplicate struct evhttp_request *req by memcpy, for example, and then connect to remote host. Another way is to do all from scratch - copy uri and headers to new evhttp_request, and then connect to remote host.
Which one of the ways is wrong?


To avoid blockings/waitings for replies from remote peer, do I need to call event_base_new(http_remote_conn) for new outgoing connection to remote host?

Thanks, Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.