Exemple #1
0
        //  makes a GET request to the upstream server on behalf of the client
        private void HttpServer_ProxyRequest(Request req, string server_address, Socket client)
        {
            string     newUri = (server_address + req.Uri);
            ProxyState ps     = new ProxyState();

            ps.client = client;
            ps.req    = req;
            Proxy1.Go(newUri, ps);
        }
Exemple #2
0
        //  sends the response from the upstream server back to the original client which made the request
        private void Proxy1_HandleResponse(string responseString, object state)
        {
            ProxyState ps     = (ProxyState)state;
            Request    req    = ps.req;
            Socket     client = ps.client;
            Response   res    = new Response(this, ps.req, ps.client);

            res.ResponseBytes = Text.Encoding.ASCII.GetBytes(responseString);
            TryCache(req, res);
            SendResponse(req, res, client);
        }