diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-22 15:03:29 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-22 15:03:29 +0000 |
commit | 413d10ceeccae85e7f418961be886a192b340a3a (patch) | |
tree | 828af79c307d2e8c29b6b6b7b24665d7770ec2e4 | |
parent | 4e0ffab8b05f5cc35996ac4866ee61cefb432af6 (diff) | |
download | rails-413d10ceeccae85e7f418961be886a192b340a3a.tar.gz rails-413d10ceeccae85e7f418961be886a192b340a3a.tar.bz2 rails-413d10ceeccae85e7f418961be886a192b340a3a.zip |
Fixed new WEBrick handling to actually pass parameters
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1483 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/lib/webrick_server.rb | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/railties/lib/webrick_server.rb b/railties/lib/webrick_server.rb index 46451e2e52..137c2570ca 100644 --- a/railties/lib/webrick_server.rb +++ b/railties/lib/webrick_server.rb @@ -13,16 +13,28 @@ class CGI @stdin || $stdin end - def stdinput=(input) - @stdin = input - end - def env_table @env_table || ENV end + + def initialize(type = "query", table = nil, stdin = nil) + @env_table, @stdin = table, stdin + + if defined?(MOD_RUBY) && !ENV.key?("GATEWAY_INTERFACE") + Apache.request.setup_cgi_env + end - def env_table=(table) - @env_table = table + 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 @@ -88,7 +100,11 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet def handle_dispatch(req, res, origin = nil) 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) assign_status(res, header) @@ -103,13 +119,6 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet end 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) env = req.meta_vars.clone env.delete "SCRIPT_NAME" |