Beispiel #1
0
        /// <summary>
        /// Create the http context.
        /// </summary>
        /// <param name="context">The current client context.</param>
        /// <returns>The http context.</returns>
        private Nequeo.Net.Http2.HttpContext CreateHttpContext(Nequeo.Net.Provider.Context context)
        {
            // If the http context has not been assign to the state.
            if (context.State == null)
            {
                // Get the underlying web context.
                Nequeo.Net.WebContext webContext = CreateWebContext(context);

                // Create the new http context from the web context.
                Nequeo.Net.Http2.HttpContext httpContext =
                    Nequeo.Net.Http2.HttpContext.CreateFrom(webContext, context.Request.Input, context.Response.Output);

                httpContext.UsePriorities  = _usePriorities;
                httpContext.UseFlowControl = _useFlowControl;

                // Return the request context.
                context.State = httpContext;
                return(httpContext);
            }
            else
            {
                // Get the saved context.
                Nequeo.Net.Http2.HttpContext httpContext = (Nequeo.Net.Http2.HttpContext)context.State;
                return(httpContext);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Member stream context.
        /// </summary>
        /// <param name="context">The web context.</param>
        public Member(Nequeo.Net.WebContext context)
        {
            _context = context;
            _output  = _context.WebResponse.Output;

            // Set the initial timeout time.
            _initialTimeOutTime = DateTime.Now;
        }
Beispiel #3
0
        /// <summary>
        /// Create the http context.
        /// </summary>
        /// <param name="context">The current client context.</param>
        /// <returns>The http context.</returns>
        private Nequeo.Net.Http.HttpContext CreateHttpContext(Nequeo.Net.Provider.Context context)
        {
            // Get the underlying web context.
            Nequeo.Net.WebContext webContext = CreateWebContext(context);

            // Create the new http context from the web context.
            Nequeo.Net.Http.HttpContext httpContext = Nequeo.Net.Http.HttpContext.CreateFrom(webContext);

            // Assign response and request data.
            httpContext.HttpResponse        = new HttpResponse();
            httpContext.HttpRequest         = new HttpRequest();
            httpContext.HttpResponse.Output = webContext.WebResponse.Output;
            httpContext.HttpRequest.Input   = webContext.WebRequest.Input;

            // Return the request context.
            return(httpContext);
        }
        /// <summary>
        /// Create the web socket context.
        /// </summary>
        /// <param name="context">The current client context.</param>
        /// <returns>The web socket context.</returns>
        private Nequeo.Net.WebSockets.WebSocketContext CreateWebSocketContext(Nequeo.Net.Provider.Context context)
        {
            // Get the underlying web context.
            Nequeo.Net.WebContext webContext = CreateWebContext(context);

            // Create the new web socket context from the web context.
            Nequeo.Net.WebSockets.WebSocketContext webSocketContext = Nequeo.Net.WebSockets.WebSocketContext.CreateFrom(webContext);

            // Assign response and request data.
            webSocketContext.WebSocketResponse        = new WebSocketResponse();
            webSocketContext.WebSocketRequest         = new WebSocketRequest();
            webSocketContext.WebSocketResponse.Output = webContext.WebResponse.Output;
            webSocketContext.WebSocketRequest.Input   = webContext.WebRequest.Input;

            // Return the request context.
            return(webSocketContext);
        }
Beispiel #5
0
 /// <summary>
 /// Create the http context from the web context.
 /// </summary>
 /// <param name="webContext">The web context to create from.</param>
 /// <param name="requestInput">The request input stream containing the raw data.</param>
 /// <param name="responseOutput">The response output stream containing the raw data.</param>
 /// <returns>The http server context.</returns>
 public static HttpContext CreateFrom(Nequeo.Net.WebContext webContext, System.IO.Stream requestInput, System.IO.Stream responseOutput)
 {
     Nequeo.Net.Http2.HttpContext httpContext = new Nequeo.Net.Http2.HttpContext(requestInput, responseOutput);
     httpContext.Context             = webContext.Context;
     httpContext.IsStartOfConnection = webContext.IsStartOfConnection;
     httpContext.IsAuthenticated     = webContext.IsAuthenticated;
     httpContext.IsSecureConnection  = webContext.IsSecureConnection;
     httpContext.Name             = webContext.Name;
     httpContext.NumberOfClients  = webContext.NumberOfClients;
     httpContext.Port             = webContext.Port;
     httpContext.RemoteEndPoint   = webContext.RemoteEndPoint;
     httpContext.ServerEndPoint   = webContext.ServerEndPoint;
     httpContext.ServiceName      = webContext.ServiceName;
     httpContext.UniqueIdentifier = webContext.UniqueIdentifier;
     httpContext.ConnectionID     = webContext.ConnectionID;
     httpContext.SessionID        = webContext.SessionID;
     httpContext.User             = webContext.User;
     httpContext.SocketState      = webContext.SocketState;
     httpContext.IsAsyncMode      = webContext.IsAsyncMode;
     return(httpContext);
 }
Beispiel #6
0
 /// <summary>
 /// Create the web socket context from the web context.
 /// </summary>
 /// <param name="webContext">The web context to create from.</param>
 /// <returns>The web socket server context.</returns>
 public static WebSocketContext CreateFrom(Nequeo.Net.WebContext webContext)
 {
     Nequeo.Net.WebSockets.WebSocketContext webSocketContext = new Nequeo.Net.WebSockets.WebSocketContext();
     webSocketContext.Context             = webContext.Context;
     webSocketContext.IsStartOfConnection = webContext.IsStartOfConnection;
     webSocketContext.IsAuthenticated     = webContext.IsAuthenticated;
     webSocketContext.IsSecureConnection  = webContext.IsSecureConnection;
     webSocketContext.Name              = webContext.Name;
     webSocketContext.NumberOfClients   = webContext.NumberOfClients;
     webSocketContext.Port              = webContext.Port;
     webSocketContext.RemoteEndPoint    = webContext.RemoteEndPoint;
     webSocketContext.ServerEndPoint    = webContext.ServerEndPoint;
     webSocketContext.ServiceName       = webContext.ServiceName;
     webSocketContext.UniqueIdentifier  = webContext.UniqueIdentifier;
     webSocketContext.ConnectionID      = webContext.ConnectionID;
     webSocketContext.SessionID         = webContext.SessionID;
     webSocketContext.User              = webContext.User;
     webSocketContext.SocketState       = webContext.SocketState;
     webSocketContext.IsAsyncMode       = webContext.IsAsyncMode;
     webSocketContext.HandshakeComplete = false;
     return(webSocketContext);
 }
Beispiel #7
0
        /// <summary>
        /// On received action handler.
        /// </summary>
        /// <param name="context">The current server context.</param>
        private void OnReceivedActionHandler(Nequeo.Net.Provider.Context context)
        {
            try
            {
                // Create the web context and set the headers.
                Nequeo.Net.WebContext webContext = CreateWebContext(context);

                // If the event has been assigned.
                if (OnWebContext != null)
                {
                    OnWebContext(this, webContext);
                }

                // Save the web context state objects.
                SaveWebContext(context, webContext);
            }
            catch (Exception)
            {
                // Close the connection and release all resources used for communication.
                context.Close();
            }
        }