Object
(Not documented)
# File lib/rack/handler/fastcgi.rb, line 19
19: def self.run(app, options={})
20: file = options[:File] and STDIN.reopen(UNIXServer.new(file))
21: port = options[:Port] and STDIN.reopen(TCPServer.new(port))
22: FCGI.each { |request|
23: serve request, app
24: }
25: end
(Not documented)
# File lib/rack/handler/fastcgi.rb, line 80
80: def self.send_body(out, body)
81: body.each { |part|
82: out.print part
83: out.flush
84: }
85: end
(Not documented)
# File lib/rack/handler/fastcgi.rb, line 69
69: def self.send_headers(out, status, headers)
70: out.print "Status: #{status}\r\n"
71: headers.each { |k, vs|
72: vs.split("\n").each { |v|
73: out.print "#{k}: #{v}\r\n"
74: }
75: }
76: out.print "\r\n"
77: out.flush
78: end
(Not documented)
# File lib/rack/handler/fastcgi.rb, line 27
27: def self.serve(request, app)
28: app = Rack::ContentLength.new(app)
29:
30: env = request.env
31: env.delete "HTTP_CONTENT_LENGTH"
32:
33: env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
34:
35: rack_input = RewindableInput.new(request.in)
36:
37: env.update({"rack.version" => [0,1],
38: "rack.input" => rack_input,
39: "rack.errors" => request.err,
40:
41: "rack.multithread" => false,
42: "rack.multiprocess" => true,
43: "rack.run_once" => false,
44:
45: "rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
46: })
47:
48: env["QUERY_STRING"] ||= ""
49: env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
50: env["REQUEST_PATH"] ||= "/"
51: env.delete "PATH_INFO" if env["PATH_INFO"] == ""
52: env.delete "CONTENT_TYPE" if env["CONTENT_TYPE"] == ""
53: env.delete "CONTENT_LENGTH" if env["CONTENT_LENGTH"] == ""
54:
55: begin
56: status, headers, body = app.call(env)
57: begin
58: send_headers request.out, status, headers
59: send_body request.out, body
60: ensure
61: body.close if body.respond_to? :close
62: end
63: ensure
64: rack_input.close
65: request.finish
66: end
67: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.