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