示例#1
0
        public Server(Reactor.Http.Server server, string path)
        {
            this.path   = path;

            this.server = server;

            if(this.server.OnContext == null)
            {
                this.server.OnContext = context =>
                {
                    context.Response.StatusCode = 401;

                    context.Response.ContentType = "text/plain";

                    context.Response.Write("method not allowed");

                    context.Response.End();
                };
            }

            this.servercb = this.server.OnContext;

            this.server.OnContext = this.OnContext;

            this.OnUpgrade = (context, callback) => callback(true, string.Empty);
        }
示例#2
0
        public Server(Reactor.Http.Server server, string path)
        {
            this.path = path;

            this.server = server;

            if (this.server.OnContext == null)
            {
                this.server.OnContext = context =>
                {
                    context.Response.StatusCode = 401;

                    context.Response.ContentType = "text/plain";

                    context.Response.Write("method not allowed");

                    context.Response.End();
                };
            }

            this.servercb = this.server.OnContext;

            this.server.OnContext = this.OnContext;

            this.OnUpgrade = (context, callback) => callback(true, string.Empty);
        }
示例#3
0
        public static Server Create(Reactor.Http.Server server, string path, Action <Socket> OnSocket)
        {
            var wsserver = new Server(server, path);

            wsserver.OnSocket = OnSocket;

            return(wsserver);
        }
示例#4
0
        public Server(int port, string path)
        {
            this.path = path;

            this.server = Reactor.Http.Server.Create(context => {
                context.Response.StatusCode = 401;

                context.Response.ContentType = "text/plain";

                context.Response.Write("method not allowed");

                context.Response.End();
            }).Listen(port);

            this.servercb = this.server.OnContext;

            this.server.OnContext = this.OnContext;

            this.OnUpgrade = (context, callback) => callback(true, string.Empty);
        }
示例#5
0
        public Server(int port, string path)
        {
            this.path = path;

            this.server = Reactor.Http.Server.Create(context => {

                context.Response.StatusCode = 401;

                context.Response.ContentType = "text/plain";

                context.Response.Write("method not allowed");

                context.Response.End();

            }).Listen(port);

            this.servercb = this.server.OnContext;

            this.server.OnContext = this.OnContext;

            this.OnUpgrade = (context, callback) => callback(true, string.Empty);
        }
示例#6
0
 public static Server Create(Reactor.Http.Server server, string path)
 {
     return(new Server(server, path));
 }
示例#7
0
 public static Server Create(Reactor.Http.Server server)
 {
     return(new Server(server, "/"));
 }