Bugfixes and Rails Edge
Update to Rails 2.3.1. (Actually, not quite. Doesn't look like 2.3.1 will be released today, but I REALLY want to push these bugfixes out.) Removed bundled Rack (Rails 2.3.1 comes bundled with Rack 1.0). Add config.action_view.cache_template_loading = true to production environment. Fix FastCGI bug (http://rubyforge.org/tracker/index.php?func=detail&aid=24191&group_id=186&atid=783). Fix WikiWords bug (http://rubyforge.org/pipermail/instiki-users/2009-February/001181.html).
This commit is contained in:
parent
0ddef97328
commit
133c21b801
641 changed files with 20541 additions and 71675 deletions
57
vendor/plugins/rack/lib/rack/handler/cgi.rb
vendored
57
vendor/plugins/rack/lib/rack/handler/cgi.rb
vendored
|
@ -1,57 +0,0 @@
|
|||
module Rack
|
||||
module Handler
|
||||
class CGI
|
||||
def self.run(app, options=nil)
|
||||
serve app
|
||||
end
|
||||
|
||||
def self.serve(app)
|
||||
env = ENV.to_hash
|
||||
env.delete "HTTP_CONTENT_LENGTH"
|
||||
|
||||
env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
|
||||
|
||||
env.update({"rack.version" => [0,1],
|
||||
"rack.input" => STDIN,
|
||||
"rack.errors" => STDERR,
|
||||
|
||||
"rack.multithread" => false,
|
||||
"rack.multiprocess" => true,
|
||||
"rack.run_once" => true,
|
||||
|
||||
"rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
|
||||
})
|
||||
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
|
||||
env["REQUEST_PATH"] ||= "/"
|
||||
|
||||
status, headers, body = app.call(env)
|
||||
begin
|
||||
send_headers status, headers
|
||||
send_body body
|
||||
ensure
|
||||
body.close if body.respond_to? :close
|
||||
end
|
||||
end
|
||||
|
||||
def self.send_headers(status, headers)
|
||||
STDOUT.print "Status: #{status}\r\n"
|
||||
headers.each { |k, vs|
|
||||
vs.each { |v|
|
||||
STDOUT.print "#{k}: #{v}\r\n"
|
||||
}
|
||||
}
|
||||
STDOUT.print "\r\n"
|
||||
STDOUT.flush
|
||||
end
|
||||
|
||||
def self.send_body(body)
|
||||
body.each { |part|
|
||||
STDOUT.print part
|
||||
STDOUT.flush
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'swiftcore/evented_mongrel'
|
||||
|
||||
module Rack
|
||||
module Handler
|
||||
class EventedMongrel < Handler::Mongrel
|
||||
end
|
||||
end
|
||||
end
|
86
vendor/plugins/rack/lib/rack/handler/fastcgi.rb
vendored
86
vendor/plugins/rack/lib/rack/handler/fastcgi.rb
vendored
|
@ -1,86 +0,0 @@
|
|||
require 'fcgi'
|
||||
require 'socket'
|
||||
|
||||
module Rack
|
||||
module Handler
|
||||
class FastCGI
|
||||
def self.run(app, options={})
|
||||
file = options[:File] and STDIN.reopen(UNIXServer.new(file))
|
||||
port = options[:Port] and STDIN.reopen(TCPServer.new(port))
|
||||
FCGI.each { |request|
|
||||
serve request, app
|
||||
}
|
||||
end
|
||||
|
||||
module ProperStream # :nodoc:
|
||||
def each # This is missing by default.
|
||||
while line = gets
|
||||
yield line
|
||||
end
|
||||
end
|
||||
|
||||
def read(*args)
|
||||
if args.empty?
|
||||
super || "" # Empty string on EOF.
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.serve(request, app)
|
||||
env = request.env
|
||||
env.delete "HTTP_CONTENT_LENGTH"
|
||||
|
||||
request.in.extend ProperStream
|
||||
|
||||
env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
|
||||
|
||||
env.update({"rack.version" => [0,1],
|
||||
"rack.input" => request.in,
|
||||
"rack.errors" => request.err,
|
||||
|
||||
"rack.multithread" => false,
|
||||
"rack.multiprocess" => true,
|
||||
"rack.run_once" => false,
|
||||
|
||||
"rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
|
||||
})
|
||||
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
|
||||
env["REQUEST_PATH"] ||= "/"
|
||||
env.delete "PATH_INFO" if env["PATH_INFO"] == ""
|
||||
env.delete "CONTENT_TYPE" if env["CONTENT_TYPE"] == ""
|
||||
env.delete "CONTENT_LENGTH" if env["CONTENT_LENGTH"] == ""
|
||||
|
||||
status, headers, body = app.call(env)
|
||||
begin
|
||||
send_headers request.out, status, headers
|
||||
send_body request.out, body
|
||||
ensure
|
||||
body.close if body.respond_to? :close
|
||||
request.finish
|
||||
end
|
||||
end
|
||||
|
||||
def self.send_headers(out, status, headers)
|
||||
out.print "Status: #{status}\r\n"
|
||||
headers.each { |k, vs|
|
||||
vs.each { |v|
|
||||
out.print "#{k}: #{v}\r\n"
|
||||
}
|
||||
}
|
||||
out.print "\r\n"
|
||||
out.flush
|
||||
end
|
||||
|
||||
def self.send_body(out, body)
|
||||
body.each { |part|
|
||||
out.print part
|
||||
out.flush
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
52
vendor/plugins/rack/lib/rack/handler/lsws.rb
vendored
52
vendor/plugins/rack/lib/rack/handler/lsws.rb
vendored
|
@ -1,52 +0,0 @@
|
|||
require 'lsapi'
|
||||
#require 'cgi'
|
||||
module Rack
|
||||
module Handler
|
||||
class LSWS
|
||||
def self.run(app, options=nil)
|
||||
while LSAPI.accept != nil
|
||||
serve app
|
||||
end
|
||||
end
|
||||
def self.serve(app)
|
||||
env = ENV.to_hash
|
||||
env.delete "HTTP_CONTENT_LENGTH"
|
||||
env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
|
||||
env.update({"rack.version" => [0,1],
|
||||
"rack.input" => STDIN,
|
||||
"rack.errors" => STDERR,
|
||||
"rack.multithread" => false,
|
||||
"rack.multiprocess" => true,
|
||||
"rack.run_once" => false,
|
||||
"rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
|
||||
})
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
|
||||
env["REQUEST_PATH"] ||= "/"
|
||||
status, headers, body = app.call(env)
|
||||
begin
|
||||
send_headers status, headers
|
||||
send_body body
|
||||
ensure
|
||||
body.close if body.respond_to? :close
|
||||
end
|
||||
end
|
||||
def self.send_headers(status, headers)
|
||||
print "Status: #{status}\r\n"
|
||||
headers.each { |k, vs|
|
||||
vs.each { |v|
|
||||
print "#{k}: #{v}\r\n"
|
||||
}
|
||||
}
|
||||
print "\r\n"
|
||||
STDOUT.flush
|
||||
end
|
||||
def self.send_body(body)
|
||||
body.each { |part|
|
||||
print part
|
||||
STDOUT.flush
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
82
vendor/plugins/rack/lib/rack/handler/mongrel.rb
vendored
82
vendor/plugins/rack/lib/rack/handler/mongrel.rb
vendored
|
@ -1,82 +0,0 @@
|
|||
require 'mongrel'
|
||||
require 'stringio'
|
||||
|
||||
module Rack
|
||||
module Handler
|
||||
class Mongrel < ::Mongrel::HttpHandler
|
||||
def self.run(app, options={})
|
||||
server = ::Mongrel::HttpServer.new(options[:Host] || '0.0.0.0',
|
||||
options[:Port] || 8080)
|
||||
# Acts like Rack::URLMap, utilizing Mongrel's own path finding methods.
|
||||
# Use is similar to #run, replacing the app argument with a hash of
|
||||
# { path=>app, ... } or an instance of Rack::URLMap.
|
||||
if options[:map]
|
||||
if app.is_a? Hash
|
||||
app.each do |path, appl|
|
||||
path = '/'+path unless path[0] == ?/
|
||||
server.register(path, Rack::Handler::Mongrel.new(appl))
|
||||
end
|
||||
elsif app.is_a? URLMap
|
||||
app.instance_variable_get(:@mapping).each do |(host, path, appl)|
|
||||
next if !host.nil? && !options[:Host].nil? && options[:Host] != host
|
||||
path = '/'+path unless path[0] == ?/
|
||||
server.register(path, Rack::Handler::Mongrel.new(appl))
|
||||
end
|
||||
else
|
||||
raise ArgumentError, "first argument should be a Hash or URLMap"
|
||||
end
|
||||
else
|
||||
server.register('/', Rack::Handler::Mongrel.new(app))
|
||||
end
|
||||
yield server if block_given?
|
||||
server.run.join
|
||||
end
|
||||
|
||||
def initialize(app)
|
||||
@app = app
|
||||
end
|
||||
|
||||
def process(request, response)
|
||||
env = {}.replace(request.params)
|
||||
env.delete "HTTP_CONTENT_TYPE"
|
||||
env.delete "HTTP_CONTENT_LENGTH"
|
||||
|
||||
env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
|
||||
|
||||
env.update({"rack.version" => [0,1],
|
||||
"rack.input" => request.body || StringIO.new(""),
|
||||
"rack.errors" => STDERR,
|
||||
|
||||
"rack.multithread" => true,
|
||||
"rack.multiprocess" => false, # ???
|
||||
"rack.run_once" => false,
|
||||
|
||||
"rack.url_scheme" => "http",
|
||||
})
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env.delete "PATH_INFO" if env["PATH_INFO"] == ""
|
||||
|
||||
status, headers, body = @app.call(env)
|
||||
|
||||
begin
|
||||
response.status = status.to_i
|
||||
response.send_status(nil)
|
||||
|
||||
headers.each { |k, vs|
|
||||
vs.each { |v|
|
||||
response.header[k] = v
|
||||
}
|
||||
}
|
||||
response.send_header
|
||||
|
||||
body.each { |part|
|
||||
response.write part
|
||||
response.socket.flush
|
||||
}
|
||||
ensure
|
||||
body.close if body.respond_to? :close
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
57
vendor/plugins/rack/lib/rack/handler/scgi.rb
vendored
57
vendor/plugins/rack/lib/rack/handler/scgi.rb
vendored
|
@ -1,57 +0,0 @@
|
|||
require 'scgi'
|
||||
require 'stringio'
|
||||
|
||||
module Rack
|
||||
module Handler
|
||||
class SCGI < ::SCGI::Processor
|
||||
attr_accessor :app
|
||||
|
||||
def self.run(app, options=nil)
|
||||
new(options.merge(:app=>app,
|
||||
:host=>options[:Host],
|
||||
:port=>options[:Port],
|
||||
:socket=>options[:Socket])).listen
|
||||
end
|
||||
|
||||
def initialize(settings = {})
|
||||
@app = settings[:app]
|
||||
@log = Object.new
|
||||
def @log.info(*args); end
|
||||
def @log.error(*args); end
|
||||
super(settings)
|
||||
end
|
||||
|
||||
def process_request(request, input_body, socket)
|
||||
env = {}.replace(request)
|
||||
env.delete "HTTP_CONTENT_TYPE"
|
||||
env.delete "HTTP_CONTENT_LENGTH"
|
||||
env["REQUEST_PATH"], env["QUERY_STRING"] = env["REQUEST_URI"].split('?', 2)
|
||||
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
|
||||
env["PATH_INFO"] = env["REQUEST_PATH"]
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env["SCRIPT_NAME"] = ""
|
||||
env.update({"rack.version" => [0,1],
|
||||
"rack.input" => StringIO.new(input_body),
|
||||
"rack.errors" => STDERR,
|
||||
|
||||
"rack.multithread" => true,
|
||||
"rack.multiprocess" => true,
|
||||
"rack.run_once" => false,
|
||||
|
||||
"rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
|
||||
})
|
||||
status, headers, body = app.call(env)
|
||||
begin
|
||||
socket.write("Status: #{status}\r\n")
|
||||
headers.each do |k, vs|
|
||||
vs.each {|v| socket.write("#{k}: #{v}\r\n")}
|
||||
end
|
||||
socket.write("\r\n")
|
||||
body.each {|s| socket.write(s)}
|
||||
ensure
|
||||
body.close if body.respond_to? :close
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'swiftcore/swiftiplied_mongrel'
|
||||
|
||||
module Rack
|
||||
module Handler
|
||||
class SwiftipliedMongrel < Handler::Mongrel
|
||||
end
|
||||
end
|
||||
end
|
15
vendor/plugins/rack/lib/rack/handler/thin.rb
vendored
15
vendor/plugins/rack/lib/rack/handler/thin.rb
vendored
|
@ -1,15 +0,0 @@
|
|||
require "thin"
|
||||
|
||||
module Rack
|
||||
module Handler
|
||||
class Thin
|
||||
def self.run(app, options={})
|
||||
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
|
||||
options[:Port] || 8080,
|
||||
app)
|
||||
yield server if block_given?
|
||||
server.start
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
62
vendor/plugins/rack/lib/rack/handler/webrick.rb
vendored
62
vendor/plugins/rack/lib/rack/handler/webrick.rb
vendored
|
@ -1,62 +0,0 @@
|
|||
require 'webrick'
|
||||
require 'stringio'
|
||||
|
||||
module Rack
|
||||
module Handler
|
||||
class WEBrick < ::WEBrick::HTTPServlet::AbstractServlet
|
||||
def self.run(app, options={})
|
||||
server = ::WEBrick::HTTPServer.new(options)
|
||||
server.mount "/", Rack::Handler::WEBrick, app
|
||||
trap(:INT) { server.shutdown }
|
||||
trap('TERM') { server.shutdown }
|
||||
yield server if block_given?
|
||||
server.start
|
||||
end
|
||||
|
||||
def initialize(server, app)
|
||||
super server
|
||||
@app = app
|
||||
end
|
||||
|
||||
def service(req, res)
|
||||
env = req.meta_vars
|
||||
env.delete_if { |k, v| v.nil? }
|
||||
|
||||
env.update({"rack.version" => [0,1],
|
||||
"rack.input" => StringIO.new(req.body.to_s),
|
||||
"rack.errors" => STDERR,
|
||||
|
||||
"rack.multithread" => true,
|
||||
"rack.multiprocess" => false,
|
||||
"rack.run_once" => false,
|
||||
|
||||
"rack.url_scheme" => ["yes", "on", "1"].include?(ENV["HTTPS"]) ? "https" : "http"
|
||||
})
|
||||
|
||||
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env["REQUEST_PATH"] ||= "/"
|
||||
env.delete "PATH_INFO" if env["PATH_INFO"] == ""
|
||||
|
||||
status, headers, body = @app.call(env)
|
||||
begin
|
||||
res.status = status.to_i
|
||||
headers.each { |k, vs|
|
||||
if k.downcase == "set-cookie"
|
||||
res.cookies.concat vs.to_a
|
||||
else
|
||||
vs.each { |v|
|
||||
res[k] = v
|
||||
}
|
||||
end
|
||||
}
|
||||
body.each { |part|
|
||||
res.body << part
|
||||
}
|
||||
ensure
|
||||
body.close if body.respond_to? :close
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue