protected override void ProcessConnection(TcpClient socket)
 {
     using(var processor = new HttpProcessor(socket, this))
     {
         processor.Process();
     }
 }
        public override void HandleGetRequest(HttpProcessor p)
        {
            Log.Debug(@"request: {0}", p.HttpUrl);

            LastRequestData = new RequestData(p.HttpMethod, p.HttpUrl, p.HttpProtocolVersionstring, p.HttpHeaders);

            SendResponse(p);
        }
        public override void HandlePostRequest(HttpProcessor p, StreamReader inputData)
        {
            Log.Debug(@"POST request: {0}", p.HttpUrl);

            LastRequestData = new RequestData(p.HttpMethod, p.HttpUrl, p.HttpProtocolVersionstring, p.HttpHeaders)
            {
                Data = inputData.ReadToEnd() 
            };

            SendResponse(p);
        }
        void SendResponse(HttpProcessor p)
        {
            p.OutputWriter.WriteLine("HTTP/1.0 200 OK");

            if (ResponseToBeSent != null && !string.IsNullOrWhiteSpace(ResponseToBeSent.ContentType))
                p.OutputWriter.WriteLine("Content-Type: {0}", ResponseToBeSent.ContentType);

            p.OutputWriter.WriteLine("Connection: close");
            p.OutputWriter.WriteLine("");

            if (ResponseToBeSent != null && !string.IsNullOrWhiteSpace(ResponseToBeSent.Data))
                p.OutputWriter.WriteLine(ResponseToBeSent.Data);
        }
 public abstract void HandlePostRequest(HttpProcessor p, StreamReader inputData);
 public abstract void HandleGetRequest(HttpProcessor p);