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