Parent

Class Index [+]

Quicksearch

Rack::Handler::LSWS

Public Class Methods

run(app, options=nil) click to toggle source
    # File lib/rack/handler/lsws.rb, line 8
 8:       def self.run(app, options=nil)
 9:         while LSAPI.accept != nil
10:           serve app
11:         end
12:       end
send_body(body) click to toggle source
    # File lib/rack/handler/lsws.rb, line 53
53:       def self.send_body(body)
54:         body.each { |part|
55:           print part
56:           STDOUT.flush
57:         }
58:       end
send_headers(status, headers) click to toggle source
    # File lib/rack/handler/lsws.rb, line 43
43:       def self.send_headers(status, headers)
44:         print "Status: #{status}\r\n"
45:         headers.each { |k, vs|
46:           vs.split("\n").each { |v|
47:             print "#{k}: #{v}\r\n"
48:           }
49:         }
50:         print "\r\n"
51:         STDOUT.flush
52:       end
serve(app) click to toggle source
    # File lib/rack/handler/lsws.rb, line 13
13:       def self.serve(app)
14:         env = ENV.to_hash
15:         env.delete "HTTP_CONTENT_LENGTH"
16:         env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
17: 
18:         rack_input = RewindableInput.new($stdin.read.to_s)
19: 
20:         env.update(
21:           "rack.version" => Rack::VERSION,
22:           "rack.input" => rack_input,
23:           "rack.errors" => $stderr,
24:           "rack.multithread" => false,
25:           "rack.multiprocess" => true,
26:           "rack.run_once" => false,
27:           "rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
28:         )
29: 
30:         env["QUERY_STRING"] ||= ""
31:         env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
32:         env["REQUEST_PATH"] ||= "/"
33:         status, headers, body = app.call(env)
34:         begin
35:           send_headers status, headers
36:           send_body body
37:         ensure
38:           body.close if body.respond_to? :close
39:         end
40:       ensure
41:         rack_input.close
42:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.