1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fixed new WEBrick handling to actually pass parameters

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1483 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-06-22 15:03:29 +00:00
parent 4e0ffab8b0
commit 413d10ceec

View file

@ -13,16 +13,28 @@ class CGI
@stdin || $stdin @stdin || $stdin
end end
def stdinput=(input)
@stdin = input
end
def env_table def env_table
@env_table || ENV @env_table || ENV
end end
def initialize(type = "query", table = nil, stdin = nil)
@env_table, @stdin = table, stdin
def env_table=(table) if defined?(MOD_RUBY) && !ENV.key?("GATEWAY_INTERFACE")
@env_table = table Apache.request.setup_cgi_env
end
extend QueryExtension
@multipart = false
if defined?(CGI_PARAMS)
warn "do not use CGI_PARAMS and CGI_COOKIES"
@params = CGI_PARAMS.dup
@cookies = CGI_COOKIES.dup
else
initialize_query() # set @params, @cookies
end
@output_cookies = nil
@output_hidden = nil
end end
end end
@ -88,7 +100,11 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
def handle_dispatch(req, res, origin = nil) def handle_dispatch(req, res, origin = nil)
data = StringIO.new data = StringIO.new
Dispatcher.dispatch(create_cgi(req, origin), ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, data) Dispatcher.dispatch(
CGI.new("query", create_env_table(req, origin), StringIO.new(req.body || "")),
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
data
)
header, body = extract_header_and_body(data) header, body = extract_header_and_body(data)
assign_status(res, header) assign_status(res, header)
@ -103,13 +119,6 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
end end
private private
def create_cgi(req, origin)
cgi = CGI.new
cgi.env_table = create_env_table(req, origin)
cgi.stdinput = req.body || ""
return cgi
end
def create_env_table(req, origin) def create_env_table(req, origin)
env = req.meta_vars.clone env = req.meta_vars.clone
env.delete "SCRIPT_NAME" env.delete "SCRIPT_NAME"