Beispiel #1
0
        private void GenerateResponse(FastCGIRequestAsync request, FastCGIResponseAsync response)
        {
            var handler = handlers[request.Params["SCRIPT_FILENAME"]];

            FastCGIRequest requestArg = new FastCGIRequest(request);

            var responseResult = handler(requestArg);

            response.StdOutWriter.WriteLine("Hi!");
        }
        internal void WriteToResponse(FastCGIResponseAsync asyncResponse)
        {
            asyncResponse.Headers.Add("Status", ((int)StatusCode).ToString());

            foreach (var header in Headers.AllKeys)
            {
                asyncResponse.Headers.Add(header, Headers.Get(header));
            }

            OutputStream.CopyTo(asyncResponse.StdOutStream);
        }
Beispiel #3
0
 private void HandleRequest(FastCGIRequestAsync request, FastCGIResponseAsync response)
 {
     if (!handlers.ContainsKey(request.Params["SCRIPT_FILENAME"]))
     {
         GenerateNotFoundResponse(response);
     }
     else
     {
         GenerateResponse(request, response);
     }
 }
Beispiel #4
0
 private void GenerateNotFoundResponse(FastCGIResponseAsync response)
 {
     response.Headers.Add("Status", "404 Not Found");
 }
Beispiel #5
0
        public override Task HandleRequestAsync(FastCGIRequestAsync request, FastCGIResponseAsync response)
        {
            Action <FastCGIRequestAsync, FastCGIResponseAsync> action = this.HandleRequest;

            return(Task.Factory.FromAsync(action.BeginInvoke, action.EndInvoke, request, response, null));
        }