MTSC  1.0.5
Build TCP servers out of modules with handlers for communication, exception and logging.
Http404Module.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using MTSC.Server;
5 using MTSC.Server.Handlers;
6 
8 {
12  public class Http404Module : IHttpModule
13  {
22  bool IHttpModule.HandleRequest(Server.Server server, HttpHandler handler, ClientData client, HttpMessage request, ref HttpMessage response)
23  {
24  if(request.Method == HttpMessage.MethodEnum.Get)
25  {
26  //client.ToBeRemoved = true;
27  response.StatusCode = HttpMessage.StatusCodes.NotFound;
28  response[HttpMessage.GeneralHeadersEnum.Date] = DateTime.Now.ToString();
29  }
30  return true;
31  }
32 
33  void IHttpModule.Tick(Server.Server server, HttpHandler handler)
34  {
35 
36  }
37  }
38 }
void Tick(Server.Server server, HttpHandler handler)
Perform periodic operations.
Structure containing client information.
Definition: Server.cs:402
Handler for handling server http requests.
Definition: HttpHandler.cs:15
Simple module that returns status code 404.
Server()
Creates an instance of server with default values.
Definition: Server.cs:68
Basic server class to handle TCP connections.
Definition: Server.cs:20
bool HandleRequest(Server.Server server, HttpHandler handler, ClientData client, HttpMessage request, ref HttpMessage response)
Handle the received request.
Definition: Client.cs:14
Interface for Http modules used by the server http handler.
Definition: IHttpModule.cs:13