Parent

Class Index [+]

Quicksearch

Rack::Handler::LSWS

Public Class Methods

run(app, options=nil) click to toggle source

(Not documented)

    # 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

(Not documented)

    # File lib/rack/handler/lsws.rb, line 55
55:       def self.send_body(body)
56:         body.each { |part|
57:           print part
58:           STDOUT.flush
59:         }
60:       end
send_headers(status, headers) click to toggle source

(Not documented)

    # File lib/rack/handler/lsws.rb, line 45
45:       def self.send_headers(status, headers)
46:         print "Status: #{status}\r\n"
47:         headers.each { |k, vs|
48:           vs.split("\n").each { |v|
49:             print "#{k}: #{v}\r\n"
50:           }
51:         }
52:         print "\r\n"
53:         STDOUT.flush
54:       end
serve(app) click to toggle source

(Not documented)

    # File lib/rack/handler/lsws.rb, line 13
13:       def self.serve(app)
14:         app = Rack::ContentLength.new(app)
15: 
16:         env = ENV.to_hash
17:         env.delete "HTTP_CONTENT_LENGTH"
18:         env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
19: 
20:         rack_input = RewindableInput.new($stdin.read.to_s)
21: 
22:         env.update(
23:           "rack.version" => [1,1],
24:           "rack.input" => rack_input,
25:           "rack.errors" => $stderr,
26:           "rack.multithread" => false,
27:           "rack.multiprocess" => true,
28:           "rack.run_once" => false,
29:           "rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
30:         )
31: 
32:         env["QUERY_STRING"] ||= ""
33:         env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
34:         env["REQUEST_PATH"] ||= "/"
35:         status, headers, body = app.call(env)
36:         begin
37:           send_headers status, headers
38:           send_body body
39:         ensure
40:           body.close if body.respond_to? :close
41:         end
42:       ensure
43:         rack_input.close
44:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.