I am creating a HTTPS Forward Proxy Server using the example given in Proxygen's proxygen-proxy Project. I have modified some changes to make it work as I want.
The code flow of the HTTPS Forward Proxy Server is mentioned below:
HTTPServer is listening for connections on port X.
AcceptorFactory is initialized with a SessionPool which is common for the whole proxy.
AcceptorFactory creates HTTPServerAcceptor according to number of threads present in PC.
While creating instances of HTTPServerAcceptor, SessionPool object is being shared as pointers.
When connection is accepted it is processed in HTTPServerAcceptor.
HTTPServerAcceptor establishes the downstream connection.
While creating a downstream session, it asks for a RequestHandler.
HTTPServerAcceptor creates a RequestHandler with SessionPool's pointer and sends it to Downstream Session.
Then the Request in sent to RequestHandler.
RequestHandler checks the SessionPool whether already a session is available for the Upstream session, if present uses the session, if not it establishes an upstream connection and creates an Upstream Session and the created UpstreamSession is stored in that SessionPool.
In this flow, I implemented SessionPool at AcceptorFactory and sending that SessionPool's pointer to HTTPServerAcceptor and RequestHandler thereby a common SessionPool is utilized by the whole proxy making it efficient.
Is this approach correct?
Note: ProxyServer is working in TLS 1.3 HTTP/2 Protocol as Forward Proxy.
I am creating a HTTPS Forward Proxy Server using the example given in Proxygen's proxygen-proxy Project. I have modified some changes to make it work as I want.
The code flow of the HTTPS Forward Proxy Server is mentioned below:
HTTPServer
is listening for connections on port X.AcceptorFactory
is initialized with aSessionPool
which is common for the whole proxy.AcceptorFactory
createsHTTPServerAcceptor
according to number of threads present in PC. While creating instances ofHTTPServerAcceptor
,SessionPool
object is being shared as pointers. When connection is accepted it is processed inHTTPServerAcceptor
.HTTPServerAcceptor
establishes the downstream connection. While creating a downstream session, it asks for aRequestHandler
.HTTPServerAcceptor
creates aRequestHandler
withSessionPool
's pointer and sends it to Downstream Session. Then the Request in sent toRequestHandler
.RequestHandler
checks theSessionPool
whether already a session is available for the Upstream session, if present uses the session, if not it establishes an upstream connection and creates an Upstream Session and the created UpstreamSession is stored in thatSessionPool
. In this flow, I implementedSessionPool
atAcceptorFactory
and sending thatSessionPool
's pointer toHTTPServerAcceptor
andRequestHandler
thereby a commonSessionPool
is utilized by the whole proxy making it efficient.Is this approach correct?
Note: ProxyServer is working in TLS 1.3 HTTP/2 Protocol as Forward Proxy.