Esempio n. 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>
        /// <returns>Created HTTP listener.</returns>
        public static HttpListener Create(IPAddress address, int port, X509Certificate certificate)
        {
            RequestParserFactory requestFactory = new RequestParserFactory();
            HttpContextFactory   factory        = new HttpContextFactory(NullLogWriter.Instance, 16384, requestFactory);

            return(new HttpListener(address, port, factory, certificate));
        }
Esempio n. 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>
        /// <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));
        }