Parent

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 52
52:       def self.send_body(body)
53:         body.each { |part|
54:           print part
55:           STDOUT.flush
56:         }
57:       end
send_headers(status, headers) click to toggle source

(Not documented)

    # File lib/rack/handler/lsws.rb, line 42
42:       def self.send_headers(status, headers)
43:         print "Status: #{status}\r\n"
44:         headers.each { |k, vs|
45:           vs.split("\n").each { |v|
46:             print "#{k}: #{v}\r\n"
47:           }
48:         }
49:         print "\r\n"
50:         STDOUT.flush
51:       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: 
19:         rack_input = RewindableInput.new($stdin.read.to_s)
20: 
21:         env.update(
22:           "rack.version" => [1,0],
23:           "rack.input" => rack_input,
24:           "rack.errors" => $stderr,
25:           "rack.multithread" => false,
26:           "rack.multiprocess" => true,
27:           "rack.run_once" => false,
28:           "rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
29:         )
30: 
31:         env["QUERY_STRING"] ||= ""
32:         env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
33:         env["REQUEST_PATH"] ||= "/"
34:         status, headers, body = app.call(env)
35:         begin
36:           send_headers status, headers
37:           send_body body
38:         ensure
39:           body.close if body.respond_to? :close
40:         end
41:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.