Esempio n. 1
0
        public virtual void Execute()
        {
            try
            {
                int receiveBufferSize = (int)this._socket.GetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket, System.Net.Sockets.SocketOptionName.ReceiveBuffer);
                int sendBufferSize    = (int)this._socket.GetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket, System.Net.Sockets.SocketOptionName.SendBuffer);

                Bamboo.WebServer.NetworkStream  networkStream  = new Bamboo.WebServer.NetworkStream(this._socket);
                Bamboo.WebServer.BufferedStream bufferedStream = new Bamboo.WebServer.BufferedStream(networkStream, receiveBufferSize, sendBufferSize);

                this._preProcessor.PreProcess(this._socket, bufferedStream);

                bufferedStream.Close();
            }
            catch (System.Exception exception)
            {
                this.Error(exception);
            }

            try
            {
                this._socket.Close();
            }
            catch (System.Exception exception)
            {
                this.Error(exception);
            }

            this._socket       = null;
            this._preProcessor = null;
        }
Esempio n. 2
0
        public override void Execute()
        {
            try
            {
                int receiveBufferSize = (int)this._socket.GetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket, System.Net.Sockets.SocketOptionName.ReceiveBuffer);
                int sendBufferSize    = (int)this._socket.GetSocketOption(System.Net.Sockets.SocketOptionLevel.Socket, System.Net.Sockets.SocketOptionName.SendBuffer);

                Bamboo.WebServer.NetworkStream  networkStream  = new Bamboo.WebServer.NetworkStream(this._socket);
                Bamboo.WebServer.BufferedStream bufferedStream = new Bamboo.WebServer.BufferedStream(networkStream, receiveBufferSize, sendBufferSize);

                Mono.Security.Protocol.Tls.SslServerStream sslServerStream = new Mono.Security.Protocol.Tls.SslServerStream(bufferedStream, new System.Security.Cryptography.X509Certificates.X509Certificate(this._certificate), false, true);
                sslServerStream.PrivateKeyCertSelectionDelegate += new Mono.Security.Protocol.Tls.PrivateKeySelectionCallback(GetPrivateKey);

                this._preProcessor.PreProcess(this._socket, sslServerStream);

                sslServerStream.Close();
            }
            catch (System.Exception exception)
            {
                this.Error(exception);
            }

            try
            {
                this._socket.Close();
            }
            catch (System.Exception exception)
            {
                this.Error(exception);
            }

            this._socket       = null;
            this._preProcessor = null;
            this._certificate  = null;
            this._privateKey   = null;
        }