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); }
private void HandleRequest(FastCGIRequestAsync request, FastCGIResponseAsync response) { if (!handlers.ContainsKey(request.Params["SCRIPT_FILENAME"])) { GenerateNotFoundResponse(response); } else { GenerateResponse(request, response); } }
private void GenerateNotFoundResponse(FastCGIResponseAsync response) { response.Headers.Add("Status", "404 Not Found"); }
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)); }