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 7
 7:       def self.run(app, options=nil)
 8:         while LSAPI.accept != nil
 9:           serve app
10:         end
11:       end
send_body(body) click to toggle source

(Not documented)

    # File lib/rack/handler/lsws.rb, line 47
47:       def self.send_body(body)
48:         body.each { |part|
49:           print part
50:           STDOUT.flush
51:         }
52:       end
send_headers(status, headers) click to toggle source

(Not documented)

    # File lib/rack/handler/lsws.rb, line 37
37:       def self.send_headers(status, headers)
38:         print "Status: #{status}\r\n"
39:         headers.each { |k, vs|
40:           vs.split("\n").each { |v|
41:             print "#{k}: #{v}\r\n"
42:           }
43:         }
44:         print "\r\n"
45:         STDOUT.flush
46:       end
serve(app) click to toggle source

(Not documented)

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.