Description
Tried to implement a simple proxy server, as the case in #102.
If I'm correct, OnRequest
is called every time when a connection is readable. As a large request may be split into multiple packets, is it correct to loop read in the OnRequest
callback?
I want to pass the client connection into the context of the downstream client connection:
In server OnConnection
: create a downstream client connection, attach server connection to it in its context.
In server OnRequest
: get the downstream connection from context, forward every bytes in requests.
In downstream client OnRequest
: get attached server connection, write every bytes of responses back through it.
It's easy to implement in java/netty. How can I do this using netpoll
? Or any better approach. Thank you.