コード例 #1
0
        async public Task Process()
        {
            Debug.Write("Request: ");
            if (Prologue.Method == "CONNECT")
            {
                Debug.Write("SSL: ");

                var proxySslResponse = new ProxySslResponse(Prologue.Version, HttpStatusCode.OK, "Connection Established");
                proxySslResponse.Prologue.WriteTo(ClientStream);

                var sslRequest = await ProxySslRequest.For(this, _requestInspector);

                await sslRequest.Process();

                return;
            }

            await InitRemoteSocket();
            await InitRemoteStream();

            await WritePrologueToRemote();

            await CopyContentFromClientToServer();

            await GetResponse();

            await WriteResponseToClient();

            //End();

            if (RemoteSocket != null && Response.Prologue.Headers.ContainsIgnoreCase("Connection", "Keep-Alive"))
            {
                RemoteSocketProvider.Return(RemoteEndPoint, RemoteSocket);
            }
            else
            {
                End();
            }

            Debug.WriteLine("Done");
        }
コード例 #2
0
        private async Task InitRemoteSocket()
        {
            RemoteEndPoint = await GetIPEndpoint();

            RemoteSocket = await RemoteSocketProvider.Get(RemoteEndPoint);
        }