using System; using System.Collections.Generic; using System.Net; using System.Security.Principal; using System.Threading; using System.Threading.Tasks; using EmbedIO.Routing; using EmbedIO.Sessions; namespace EmbedIO { /// /// Represents the context of a HTTP(s) request being handled by a web server. /// public interface IHttpContext : IMimeTypeProvider { /// /// Gets a unique identifier for a HTTP context. /// string Id { get; } /// /// Gets a used to stop processing of this context. /// CancellationToken CancellationToken { get; } /// /// Gets the server IP address and port number to which the request is directed. /// IPEndPoint LocalEndPoint { get; } /// /// Gets the client IP address and port number from which the request originated. /// IPEndPoint RemoteEndPoint { get; } /// /// Gets the HTTP request. /// IHttpRequest Request { get; } /// /// Gets the route matched by the requested URL path. /// RouteMatch Route { get; } /// /// Gets the requested path, relative to the innermost module's base path. /// /// /// This property derives from the path specified in the requested URL, stripped of the /// BaseRoute of the handling module. /// This property is in itself a valid URL path, including an initial /// slash (/) character. /// string RequestedPath { get; } /// /// Gets the HTTP response object. /// IHttpResponse Response { get; } /// /// Gets the user. /// IPrincipal User { get; } /// /// Gets the session proxy associated with this context. /// ISessionProxy Session { get; } /// /// Gets a value indicating whether compressed request bodies are supported. /// /// bool SupportCompressedRequests { get; } /// /// Gets the dictionary of data to pass trough the EmbedIO pipeline. /// IDictionary Items { get; } /// /// Gets the elapsed time, expressed in milliseconds, since the creation of this context. /// long Age { get; } /// /// Gets a value indicating whether this /// has been completely handled, so that no further processing is required. /// When a HTTP context is created, this property is ; /// as soon as it is set to , the context is not /// passed to any further module's handler for processing. /// Once it becomes , this property is guaranteed /// to never become again. /// /// /// When a module's IsFinalHandler property is /// , this property is set to after the /// returned by the module's HandleRequestAsync method /// is completed. /// /// /// bool IsHandled { get; } /// /// Marks this context as handled, so that it will not be /// processed by any further module. /// /// /// Calling this method from the /// or of a module whose /// property is /// is redundant and has no effect. /// /// /// void SetHandled(); /// /// Registers a callback to be called when processing is finished on a context. /// /// The callback. void OnClose(Action callback); } }