Exemple #1
0
        private void Dispose()
        {
            _transfer = null;
            _IPRange  = null;

            _firstPacket   = null;
            _connection    = null;
            _connectionUDP = null;

            _connetionRecvBuffer    = null;
            _remoteHeaderSendBuffer = null;

            httpProxyState = null;
        }
Exemple #2
0
 private void RspHttpHandshakeReceive()
 {
     _command = 1; // Set TCP connect command
     if (httpProxyState == null)
     {
         httpProxyState = new HttpParser();
     }
     if (IPSubnet.IsLoopBack(((IPEndPoint)_connection.RemoteEndPoint).Address))
     {
         httpProxyState.httpAuthUser = string.Empty;
         httpProxyState.httpAuthPass = string.Empty;
     }
     else
     {
         httpProxyState.httpAuthUser = _config.AuthUser;
         httpProxyState.httpAuthPass = _config.AuthPass;
     }
     for (var i = 1; ; ++i)
     {
         var err = httpProxyState.HandshakeReceive(_firstPacket, _firstPacketLength, out _remoteHeaderSendBuffer);
         if (err == 1)
         {
             if (HttpHandshakeRecv())
             {
                 break;
             }
         }
         else if (err == 2)
         {
             var dataSend = HttpParser.Http407();
             var httpData = Encoding.UTF8.GetBytes(dataSend);
             _connection.Send(httpData);
             if (HttpHandshakeRecv())
             {
                 break;
             }
         }
         else if (err is 3 or 4)
         {
             Connect();
             break;
         }