示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpContextFactory"/> class.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="bufferSize">Amount of bytes to read from the incoming socket stream.</param>
 /// <param name="factory">Used to create a request parser.</param>
 public HttpContextFactory(ILogWriter writer, int bufferSize, IRequestParserFactory factory)
 {
     _logWriter = writer;
     _bufferSize = bufferSize;
     _factory = factory;
     _contextTimeoutManager = new ContextTimeoutManager(ContextTimeoutManager.MonitorType.Thread);
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpContextFactory"/> class.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="bufferSize">Amount of bytes to read from the incoming socket stream.</param>
        /// <param name="factory">Used to create a request parser.</param>
        public HttpContextFactory(ILogWriter writer, int bufferSize, IRequestParserFactory factory)
        {
            _logWriter             = writer;
            _bufferSize            = bufferSize;
            _factory               = factory;
            _contextTimeoutManager = new ContextTimeoutManager(ContextTimeoutManager.MonitorType.Thread);

            // by Fumi.Iseki
            if (ClientCertificateValidationCallback != null)
            {
                _clientCallback = ClientCertificateValidationCallback;
                ClientCertificateValidationCallback = null;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpContextFactory"/> class.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="bufferSize">Amount of bytes to read from the incoming socket stream.</param>
        /// <param name="factory">Used to create a request parser.</param>
        public HttpContextFactory(ILogWriter writer, int bufferSize, IRequestParserFactory factory)
        {
            _logWriter = writer;
            _bufferSize = bufferSize;
            _factory = factory;
            _contextTimeoutManager = new ContextTimeoutManager(ContextTimeoutManager.MonitorType.Thread);

            // by Fumi.Iseki
            if (ClientCertificateValidationCallback != null)
            {
                _clientCallback = ClientCertificateValidationCallback;
                ClientCertificateValidationCallback = null;
            }
        }
示例#4
0
        /// <summary>
        /// Create a new context.
        /// </summary>
        /// <param name="isSecured">true if socket is running HTTPS.</param>
        /// <param name="endPoint">Client that connected</param>
        /// <param name="stream">Network/SSL stream.</param>
        /// <returns>A context.</returns>
        protected HttpClientContext CreateContext(bool isSecured, IPEndPoint endPoint, Stream stream, Socket sock)
        {
            HttpClientContext context;

            context = CreateNewContext(isSecured, endPoint, stream, sock);
            context.Disconnected    += OnFreeContext;
            context.RequestReceived += OnRequestReceived;

            context.Stream        = stream;
            context.IsSecured     = isSecured;
            context.RemotePort    = endPoint.Port.ToString();
            context.RemoteAddress = endPoint.Address.ToString();
            ContextTimeoutManager.StartMonitoringContext(context);
            m_activeContexts[context.contextID] = context;
            context.Start();
            return(context);
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpContextFactory"/> class.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="bufferSize">Amount of bytes to read from the incoming socket stream.</param>
 /// <param name="factory">Used to create a request parser.</param>
 public HttpContextFactory(ILogWriter writer, IRequestParserFactory factory)
 {
     _logWriter = writer;
     _factory   = factory;
     ContextTimeoutManager.Start();
 }
示例#6
0
 /// <summary>
 /// Server is shutting down so shut down the factory
 /// </summary>
 public void Shutdown()
 {
     ContextTimeoutManager.Stop();
 }
示例#7
0
 public void StartSendResponse(HttpResponse response)
 {
     isSendingResponse = true;
     m_currentResponse = response;
     ContextTimeoutManager.EnqueueSend(this, response.Priority);
 }