Пример #1
0
        public HandshakeSetup()
        {
            var secureProperties   = GetProperties(true);
            var unsecureProperties = GetProperties(false);

            Http2SecureServer   = new HttpSocketServer(new Http2Middleware(new ResponseMiddleware(null)).Invoke, secureProperties);
            Http2UnsecureServer = new HttpSocketServer(new Http2Middleware(new ResponseMiddleware(null)).Invoke, unsecureProperties);
        }
Пример #2
0
 public Http2Setup()
 {
     UseHandshake = GetHandshakeNeed();
     SecureServer =
         new HttpSocketServer(new Http2Middleware(new PushMiddleware(new ResponseMiddleware(null))).Invoke,
                              GetProperties(true));
     UnsecureServer =
         new HttpSocketServer(new Http2Middleware(new PushMiddleware(new ResponseMiddleware(null))).Invoke,
                              GetProperties(false));
 }
Пример #3
0
        public Http11Setup()
        {
            var appSettings = ConfigurationManager.AppSettings;

            UseSecurePort = appSettings["useSecurePort"] == "true";
            UseHandshake  = appSettings["handshakeOptions"] != "no-handshake";

            string address = UseSecurePort ? appSettings["secureAddress"] : appSettings["unsecureAddress"];

            Uri uri;

            Uri.TryCreate(address, UriKind.Absolute, out uri);

            Uri = uri;

            var properties = new Dictionary <string, object>();
            var addresses  = new List <IDictionary <string, object> >
            {
                new Dictionary <string, object>
                {
                    { "host", uri.Host },
                    { "scheme", uri.Scheme },
                    { "port", uri.Port.ToString(CultureInfo.InvariantCulture) },
                    { "path", uri.AbsolutePath }
                }
            };

            properties.Add("host.Addresses", addresses);

            bool useHandshake   = ConfigurationManager.AppSettings["handshakeOptions"] != "no-handshake";
            bool usePriorities  = ConfigurationManager.AppSettings["prioritiesOptions"] != "no-priorities";
            bool useFlowControl = ConfigurationManager.AppSettings["flowcontrolOptions"] != "no-flowcontrol";

            properties.Add("use-handshake", useHandshake);
            properties.Add("use-priorities", usePriorities);
            properties.Add("use-flowControl", useFlowControl);

            Server = new HttpSocketServer(new Http2Middleware(new ResponseMiddleware(null)).Invoke, properties);
        }