VDS.Web.Server was designed as a lightweight HTTP server for embedding in other applications. It is a completely self contained library with no dependencies that uses a
HttpListener to provide a simple but powerful web server framework.
The core of the API is the HttpServer class which represents an instance of a server, this class is used to create and configure your server and to manage its run state as desired.
The server consists of a number of components which embody different parts of functionality of the server:
- The Handlers Collection maintains the mappings from HTTP request paths to Handler instances which are capable of processing requests.
- The pre-request and pre-response Modules are used to take actions before a request is processed and before the response to the client is finalized.
- The Loggers are used to log HTTP requests
- The MIME Types Manager is used to determine how the server returns static content.
- The Virtual Directory Manager is used to manage virtual directories.
- The Console is used to log informational and error messages.
Request Processing Pipeline
A HTTP request received by the server goes through the following processing pipeline:
- The HttpServer's internal
HttpListenerreceives the HTTP request and hands it off to the request processor
- The request processor applies the pre-request modules
- Any module may signals that the server should skip any further processing, skip to step ?
- Otherwise continue to step 3
- The server attempts to map the request to a request handler
- If there is a handler proceed to step 4
- Otherwise return 404 Not Found and skip to step 5
- The request processor applies the pre-response modules
- The request processor flushes the response stream and closes the response