Used to create and reuse contexts.
상속: IHttpContextFactory
예제 #1
0
        /// <summary>
        /// Creates a new <see cref="HttpListener"/> instance with default factories.
        /// </summary>
        /// <param name="address">Address that the listener should accept connections on.</param>
        /// <param name="port">Port that listener should accept connections on.</param>
        /// <param name="certificate">Certificate to use</param>
        /// <param name="protocol">which HTTPS protocol to use, default is TLS.</param>
        /// <returns>Created HTTP listener.</returns>
        public static HttpListener Create(IPAddress address, int port, X509Certificate certificate, SslProtocols protocol)
        {
            RequestParserFactory requestFactory = new RequestParserFactory();
            HttpContextFactory   factory        = new HttpContextFactory(NullLogWriter.Instance, 16384, requestFactory);

            return(new HttpListener(address, port, factory, certificate, protocol));
        }
예제 #2
0
        /// <summary>
        /// Creates a new <see cref="HttpListener"/> instance with default factories.
        /// </summary>
        /// <param name="address">Address that the listener should accept connections on.</param>
        /// <param name="port">Port that listener should accept connections on.</param>
        /// <returns>Created HTTP listener.</returns>
        public static HttpListener Create(IPAddress address, int port)
        {
            RequestParserFactory requestFactory = new RequestParserFactory();
            HttpContextFactory   factory        = new HttpContextFactory(NullLogWriter.Instance, 16384, requestFactory);

            return(new HttpListener(address, port, factory));
        }
        /// <summary>
        /// Creates a new <see cref="HttpListener"/> instance with default factories.
        /// </summary>
        /// <param name="address">Address that the listener should accept connections on.</param>
        /// <param name="port">Port that listener should accept connections on.</param>
        /// <param name="certificate">Certificate to use</param>
        /// <param name="clientCertCallback">Callback to validate SSL client certificates.</param>
        /// <param name="protocol">which HTTPS protocol to use, default is TLS.</param>
        /// <param name="requireClientCerts">True if client SSL certificates are required, otherwise false.</param>
        /// <returns>Created HTTP listener.</returns>
        public static HttpListener Create(IPAddress address, int port, X509Certificate certificate,
                                          RemoteCertificateValidationCallback clientCertCallback, SslProtocols protocol, bool requireClientCerts)
        {
            RequestParserFactory requestFactory = new RequestParserFactory();
            HttpContextFactory   factory        = new HttpContextFactory(DefaultLogWriter.Instance, 16384, requestFactory);

            return(new HttpListener(address, port, factory, certificate, clientCertCallback, protocol, requireClientCerts));
        }
예제 #4
0
        /// <summary>
        /// Creates a new <see cref="HttpListener"/> instance with default factories.
        /// </summary>
        /// <param name="log">Logging engine for the server. Use NullLogWriter.Instance to disable</param>
        /// <param name="address">Address that the listener should accept connections on.</param>
        /// <param name="port">Port that listener should accept connections on.</param>
        /// <param name="certificate">Certificate to use</param>
        /// <returns>Created HTTP listener.</returns>
        public static HttpListener Create(ILogWriter log, IPAddress address, int port, X509Certificate certificate)
        {
            RequestParserFactory requestFactory = new RequestParserFactory();
            HttpContextFactory   factory        = new HttpContextFactory(log, 16384, requestFactory, null);
            HttpListener         listener       = new HttpListener(address, port, factory, certificate);

            listener._logWriter = log;
            return(listener);
        }
예제 #5
0
        /// <summary>
        /// Creates a new <see cref="HttpListener"/> instance with default factories.
        /// </summary>
        /// <param name="log">Logging engine for the server. Use NullLogWriter.Instance to disable</param>
        /// <param name="address">Address that the listener should accept connections on.</param>
        /// <param name="port">Port that listener should accept connections on.</param>
        /// <param name="certificate">Certificate to use</param>
        /// <param name="rootCA">Root certificate that incoming client certificates have been signed with</param>
        /// <param name="protocol">which HTTPS protocol to use, default is TLS.</param>
        /// <returns>Created HTTP listener.</returns>
        /// <param name="requireClientCerts">True if client SSL certificates are required, otherwise false</param>
        public static HttpListener Create(ILogWriter log, IPAddress address, int port, X509Certificate certificate,
                                          X509Certificate rootCA, SslProtocols protocol, bool requireClientCerts)
        {
            RequestParserFactory requestFactory = new RequestParserFactory();
            HttpContextFactory   factory        = new HttpContextFactory(log, 16384, requestFactory, rootCA);
            HttpListener         listener       = new HttpListener(address, port, factory, certificate, protocol, requireClientCerts);

            listener._logWriter = log;
            return(listener);
        }
예제 #6
0
 /// <summary>
 /// Creates a new <see cref="HttpListener"/> instance with default factories.
 /// </summary>
 /// <param name="address">Address that the listener should accept connections on.</param>
 /// <param name="port">Port that listener should accept connections on.</param>
 /// <param name="certificate">Certificate to use</param>
 /// <param name="protocol">which HTTPS protocol to use, default is TLS.</param>
 /// <returns>Created HTTP listener.</returns>
 public static HttpListener Create(IPAddress address, int port, X509Certificate certificate, SslProtocols protocol)
 {
     RequestParserFactory requestFactory = new RequestParserFactory();
     HttpContextFactory factory = new HttpContextFactory(NullLogWriter.Instance, 16384, requestFactory);
     return new HttpListener(address, port, factory, certificate, protocol);
 }
예제 #7
0
        /// <summary>
        /// Creates a new <see cref="HttpListener"/> instance with default factories.
        /// </summary>
        /// <param name="address">Address that the listener should accept connections on.</param>
        /// <param name="port">Port that listener should accept connections on.</param>
		/// <returns>Created HTTP listener.</returns>
        public static HttpListener Create (IPAddress address, int port, ILogWriter log)
        {
            RequestParserFactory requestFactory = new RequestParserFactory();
            HttpContextFactory factory = new HttpContextFactory (log, 16384, requestFactory);
            return new HttpListener(address, port, factory);
        }
 /// <summary>
 /// Creates a new <see cref="HttpListener"/> instance with default factories in SSL server mode
 /// with optional SSL client certificate checking.
 /// </summary>
 /// <param name="log">Logging engine for the server. Use NullLogWriter.Instance to disable.</param>
 /// <param name="address">Address that the listener should accept connections on.</param>
 /// <param name="port">Port that listener should accept connections on.</param>
 /// <param name="certificate">Certificate to use</param>
 /// <param name="protocol">HTTPS protocols to support, default is TLS and SSL3.</param>
 /// <returns>Created HTTP listener.</returns>
 /// <param name="requireClientCerts">True if client SSL certificates are required, otherwise false</param>
 public static HttpListener Create(ILogWriter log, IPAddress address, int port, X509Certificate certificate,
     SslProtocols protocol, bool requireClientCerts)
 {
     RequestParserFactory requestFactory = new RequestParserFactory();
     HttpContextFactory factory = new HttpContextFactory(log, 16384, requestFactory);
     HttpListener listener = new HttpListener(address, port, factory, certificate, protocol, requireClientCerts);
     listener._logWriter = log;
     return listener;
 }
예제 #9
0
 /// <summary>
 /// Creates a new <see cref="HttpListener"/> instance with default factories.
 /// </summary>
 /// <param name="address">Address that the listener should accept connections on.</param>
 /// <param name="port">Port that listener should accept connections on.</param>
 /// <param name="certificate">Certificate to use</param>
 /// <param name="clientCertCallback">Callback to validate SSL client certificates.</param>
 /// <param name="protocol">which HTTPS protocol to use, default is TLS.</param>
 /// <param name="requireClientCerts">True if client SSL certificates are required, otherwise false.</param>
 /// <returns>Created HTTP listener.</returns>
 public static HttpListener Create(IPAddress address, int port, X509Certificate certificate,
     RemoteCertificateValidationCallback clientCertCallback, SslProtocols protocol, bool requireClientCerts)
 {
     RequestParserFactory requestFactory = new RequestParserFactory();
     HttpContextFactory factory = new HttpContextFactory(NullLogWriter.Instance, 16384, requestFactory);
     return new HttpListener(address, port, factory, certificate, clientCertCallback, protocol, requireClientCerts);
 }