diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 09:07:43 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 09:07:43 +0000 |
commit | 17ef7067c86be4e01ac8320ade4f2787c9d7aa57 (patch) | |
tree | 3be29c1525081ab0cc4e1a1a2520fadad06b8910 /railties/lib | |
parent | b33557b6221c0d9f4d0a7374771b9272c48951a8 (diff) | |
download | rails-17ef7067c86be4e01ac8320ade4f2787c9d7aa57.tar.gz rails-17ef7067c86be4e01ac8320ade4f2787c9d7aa57.tar.bz2 rails-17ef7067c86be4e01ac8320ade4f2787c9d7aa57.zip |
Added -m/--mime-types option to the WEBrick server, so you can specify a Apache-style mime.types file to load #2059 [ask@develooper.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2175 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/webrick_server.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/railties/lib/webrick_server.rb b/railties/lib/webrick_server.rb index 4a73872ba3..f3938b7419 100644 --- a/railties/lib/webrick_server.rb +++ b/railties/lib/webrick_server.rb @@ -46,7 +46,11 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet def self.dispatch(options = {}) Socket.do_not_reverse_lookup = true # patch for OS X - server = WEBrick::HTTPServer.new(:Port => options[:port].to_i, :ServerType => options[:server_type], :BindAddress => options[:ip]) + server = WEBrick::HTTPServer.new(:Port => options[:port].to_i, + :ServerType => options[:server_type], + :BindAddress => options[:ip], + :MimeTypes => options[:mime_types] + ) server.mount('/', DispatchServlet, options) trap("INT") { server.shutdown } @@ -89,8 +93,8 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet path.gsub!('+', ' ') # Unescape + since FileHandler doesn't do so. req.instance_variable_set(:@path_info, path) # Set the modified path... - - @file_handler.send(:service, req, res) + + @file_handler.send(:service, req, res) return true rescue HTTPStatus::PartialContent, HTTPStatus::NotModified => err res.set_error(err) |