コード例 #1
0
ファイル: HttpProxy.cs プロジェクト: hanswolff/FryProxy
        /// <summary>
        ///     Creates new instance of <see cref="HttpProxy" /> using provided default port and internal buffer size.
        /// </summary>
        /// <param name="defaultPort">
        ///     Port number on destination server which will be used if not specified in request
        /// </param>
        public HttpProxy(Int32 defaultPort)
        {
            Contract.Requires <ArgumentOutOfRangeException>(
                defaultPort > IPEndPoint.MinPort &&
                defaultPort < IPEndPoint.MaxPort, "defaultPort"
                );

            _defaultPort = defaultPort;

            ClientReadTimeout  = DefaultCommunicationTimeout;
            ClientWriteTimeout = DefaultCommunicationTimeout;
            ServerReadTimeout  = DefaultCommunicationTimeout;
            ServerWriteTimeout = DefaultCommunicationTimeout;

            _pipeline = new ProcessingPipeline(new Dictionary <ProcessingStage, Action <ProcessingContext> >
            {
                { ProcessingStage.ReceiveRequest, ReceiveRequest + _onRequestReceivedWrapper },
                { ProcessingStage.ConnectToServer, ConnectToServer + _onServerConnectedWrapper },
                { ProcessingStage.ReceiveResponse, ReceiveResponse + _onResponseReceivedWrapper },
                { ProcessingStage.Completed, CompleteProcessing + _onProcessingCompleteWrapper },
                { ProcessingStage.SendResponse, SendResponse + _onResponseSentWrapper }
            });
        }
コード例 #2
0
ファイル: HttpProxy.cs プロジェクト: hanswolff/FryProxy
        /// <summary>
        ///     Creates new instance of <see cref="HttpProxy" /> using provided default port and internal buffer size.
        /// </summary>
        /// <param name="defaultPort">
        ///     Port number on destination server which will be used if not specified in request
        /// </param>
        public HttpProxy(Int32 defaultPort)
        {
            Contract.Requires<ArgumentOutOfRangeException>(
                defaultPort > IPEndPoint.MinPort
                && defaultPort < IPEndPoint.MaxPort, "defaultPort"
            );

            _defaultPort = defaultPort;

            ClientReadTimeout = DefaultCommunicationTimeout;
            ClientWriteTimeout = DefaultCommunicationTimeout;
            ServerReadTimeout = DefaultCommunicationTimeout;
            ServerWriteTimeout = DefaultCommunicationTimeout;

            _pipeline = new ProcessingPipeline(new Dictionary<ProcessingStage, Action<ProcessingContext>>
            {
                {ProcessingStage.ReceiveRequest, ReceiveRequest + _onRequestReceivedWrapper},
                {ProcessingStage.ConnectToServer, ConnectToServer + _onServerConnectedWrapper},
                {ProcessingStage.ReceiveResponse, ReceiveResponse + _onResponseReceivedWrapper},
                {ProcessingStage.Completed, CompleteProcessing + _onProcessingCompleteWrapper},
                {ProcessingStage.SendResponse, SendResponse + _onResponseSentWrapper}
            });
        }