# File lib/rack/handler/scgi.rb, line 23
23:       def process_request(request, input_body, socket)
24:         env = {}.replace(request)
25:         env.delete "HTTP_CONTENT_TYPE"
26:         env.delete "HTTP_CONTENT_LENGTH"
27:         env["REQUEST_PATH"], env["QUERY_STRING"] = env["REQUEST_URI"].split('?', 2)
28:         env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
29:         env["PATH_INFO"] = env["REQUEST_PATH"]
30:         env["QUERY_STRING"] ||= ""
31:         env["SCRIPT_NAME"] = ""
32: 
33:         rack_input = StringIO.new(input_body)
34:         rack_input.set_encoding(Encoding::BINARY) if rack_input.respond_to?(:set_encoding)
35: 
36:         env.update({"rack.version" => Rack::VERSION,
37:                      "rack.input" => rack_input,
38:                      "rack.errors" => $stderr,
39:                      "rack.multithread" => true,
40:                      "rack.multiprocess" => true,
41:                      "rack.run_once" => false,
42: 
43:                      "rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
44:                    })
45:         status, headers, body = app.call(env)
46:         begin
47:           socket.write("Status: #{status}\r\n")
48:           headers.each do |k, vs|
49:             vs.split("\n").each { |v| socket.write("#{k}: #{v}\r\n")}
50:           end
51:           socket.write("\r\n")
52:           body.each {|s| socket.write(s)}
53:         ensure
54:           body.close if body.respond_to? :close
55:         end
56:       end