diff --git a/Appraisals b/Appraisals index 324653b1..fe01ec6c 100644 --- a/Appraisals +++ b/Appraisals @@ -7,10 +7,12 @@ appraise "rails30" do end appraise "rails31" do + gem "i18n", "< 0.7" gem "rails", "~> 3.1.12" end appraise "rails32" do + gem "i18n", "< 0.7" gem "rails", "~> 3.2.21" end @@ -19,11 +21,20 @@ appraise "rails40" do end appraise "rails41" do - gem "rails", "~> 4.1.10" + gem "rails", "~> 4.1.16" end appraise "rails42" do - gem "rails", "~> 4.2.1" + gem "mime-types", "< 3", :require => false + gem "rails", "~> 4.2.9" +end + +appraise "rails50" do + gem "rails", "~> 5.0.5" +end + +appraise "rails51" do + gem "rails", "~> 5.1.2" end appraise "railsNG" do diff --git a/History.md b/History.md index 2144ec21..98e3d2b5 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,37 @@ +## 1.1.22 + +- compile using Java 6 source compat +- update (bundled) rack to 1.6.13 +- avoid NativeException - not used on recent JRuby +- avoid Fixnum warning - assume recent JRuby +- Add error message to log when runtime error is handled (#213) + +## 1.1.21 (17/09/17) + +- update (bundled) rack to 1.6.8 +- add Rack::Handler::Servlet::DefaultEnv#get_header (#212) + missing methods to handle ActionController::Base#reset_session +- can only safely stream natively on ActionDispatch <= 3.2 (#210) + (broken Rails streaming for Rails 4.x) +- when handling OPTION calls ignore both 'Date' and 'Allow' headers (#205) + +## 1.1.20 (22/01/16) + +- pre-maturely avoid Ruby frozen string literals coming at us ... ''.dup meh! +- allow to boot when RAILS_ROOT/public directory does not exist (closes #197) +- for better booter detection - export public path after working dir was changed +- `ActionController::Base` provides a method `servlet_response` to return the + `java.servlet_response` rack env (#201) +- adjust jruby home dir fallback (for default $LOAD_PATH) correctly on 9K and --2.0 +- servlet env should behave on `fetch` and `[]` like a Hash (nil value can be set) + +## 1.1.19 (01/07/15) + +- update (bundled) rack to 1.5.5 +- servlet attrs with null/false values should not end up with an '' env value (#195) +- tune ErrorApp + ShowStatus to respect set 'rack.showstatus.detail' (#194) +- allow for more `JRuby::Rack::ErrorApp` customizations + retrieve cause when needed + ## 1.1.18 (13/01/15) - back-port Rack::ShowStatus to be used with out ErrorApp (contains XSS fix #190) diff --git a/LICENSE.txt b/LICENSE.txt index 2e1a74da..958f5c32 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,7 +1,7 @@ #-- # The MIT License # -# Copyright (c) 2012-2014 Karol Bucek, LTD +# Copyright (c) 2012-2016 Karol Bucek, LTD. # Copyright (c) 2010-2012 Engine Yard, Inc. # Copyright (c) 2007-2009 Sun Microsystems, Inc. # diff --git a/Rakefile b/Rakefile index 629c4892..933b8fa6 100644 --- a/Rakefile +++ b/Rakefile @@ -54,11 +54,16 @@ end desc "Unpack the rack gem" task :unpack_gem => "target" do |t| target = File.expand_path(t.prerequisites.first) - spec = Gem.loaded_specs["rack"] - if spec.respond_to?(:cache_file) - gem_file = spec.cache_file - else - gem_file = File.join(spec.installation_path, 'cache', spec.file_name) + spec = Gem.loaded_specs['rack'] + # JRuby <= 1.7.20 does not handle respond_to? with method_missing right + # ... issue with Bundler::StubSpecification wrapping (in bundler 1.10.x) + unless ( gem_file = spec.cache_file rescue nil ) + #if defined?(::Bundler) && ::Bundler.const_defined?(:StubSpecification) # since Bundler 1.10.1 + # spec = spec.to_spec if spec.is_a?(::Bundler::StubSpecification) + #else + # spec = spec.to_spec if spec.respond_to?(:to_spec) + #end + gem_file = File.join(spec.base_dir, 'cache', spec.file_name) end unless uptodate?("#{target}/vendor/rack.rb", [__FILE__, gem_file]) mkdir_p "target/vendor" diff --git a/examples/sinatra/Gemfile b/examples/sinatra/Gemfile index c10abd72..bcb5db24 100644 --- a/examples/sinatra/Gemfile +++ b/examples/sinatra/Gemfile @@ -1,3 +1,6 @@ source 'https://rubygems.org' -gem 'sinatra' +gem 'sinatra', '< 4.0' +gem 'webrick' +gem "jruby-rack", "~> 1.2" +gem 'rack', '2.2.8' \ No newline at end of file diff --git a/gemfiles/rails23.gemfile b/gemfiles/rails23.gemfile index 95fff13a..f238fadd 100644 --- a/gemfiles/rails23.gemfile +++ b/gemfiles/rails23.gemfile @@ -2,7 +2,8 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test +gem "jruby-openssl", "~> 0.9.20", :group=>:test gem "rails", "~> 2.3.18" diff --git a/gemfiles/rails23.gemfile.lock b/gemfiles/rails23.gemfile.lock index dff3a162..90f66c6b 100644 --- a/gemfiles/rails23.gemfile.lock +++ b/gemfiles/rails23.gemfile.lock @@ -12,6 +12,7 @@ GEM activesupport (= 2.3.18) activesupport (2.3.18) diff-lcs (1.2.5) + jruby-openssl (0.9.21-java) rack (1.1.6) rails (2.3.18) actionmailer (= 2.3.18) @@ -20,7 +21,7 @@ GEM activeresource (= 2.3.18) activesupport (= 2.3.18) rake (>= 0.8.3) - rake (10.3.2) + rake (10.4.2) rspec (2.14.1) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) @@ -34,6 +35,10 @@ PLATFORMS java DEPENDENCIES + jruby-openssl (~> 0.9.20) rails (~> 2.3.18) - rake (~> 10.3.1) + rake (~> 10.4.2) rspec (~> 2.14.1) + +BUNDLED WITH + 1.14.6 diff --git a/gemfiles/rails30.gemfile b/gemfiles/rails30.gemfile index e2954083..ecf30f7e 100644 --- a/gemfiles/rails30.gemfile +++ b/gemfiles/rails30.gemfile @@ -2,7 +2,8 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test +gem "jruby-openssl", "~> 0.9.20", :group=>:test gem "rails", "~> 3.0.20" diff --git a/gemfiles/rails30.gemfile.lock b/gemfiles/rails30.gemfile.lock index 722f347f..81927341 100644 --- a/gemfiles/rails30.gemfile.lock +++ b/gemfiles/rails30.gemfile.lock @@ -34,6 +34,7 @@ GEM erubis (2.6.6) abstract (>= 1.0.0) i18n (0.5.4) + jruby-openssl (0.9.21-java) json (1.8.1-java) mail (2.2.20) activesupport (>= 2.3.6) @@ -61,7 +62,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.4) - rake (10.3.2) + rake (10.4.2) rdoc (3.12.2) json (~> 1.4) rspec (2.14.1) @@ -82,6 +83,10 @@ PLATFORMS java DEPENDENCIES + jruby-openssl (~> 0.9.20) rails (~> 3.0.20) - rake (~> 10.3.1) + rake (~> 10.4.2) rspec (~> 2.14.1) + +BUNDLED WITH + 1.14.6 diff --git a/gemfiles/rails31.gemfile b/gemfiles/rails31.gemfile index 7ade1cb9..08a6e69a 100644 --- a/gemfiles/rails31.gemfile +++ b/gemfiles/rails31.gemfile @@ -2,7 +2,9 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test +gem "jruby-openssl", "~> 0.9.20", :group=>:test +gem "i18n", "< 0.7" gem "rails", "~> 3.1.12" diff --git a/gemfiles/rails31.gemfile.lock b/gemfiles/rails31.gemfile.lock index efd2dbfc..d2ba1cb6 100644 --- a/gemfiles/rails31.gemfile.lock +++ b/gemfiles/rails31.gemfile.lock @@ -35,13 +35,14 @@ GEM erubis (2.7.0) hike (1.2.3) i18n (0.6.11) - json (1.8.1-java) + jruby-openssl (0.9.21-java) + json (1.8.2-java) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - multi_json (1.10.1) + multi_json (1.11.0) polyglot (0.3.5) rack (1.3.10) rack-cache (1.2) @@ -50,7 +51,7 @@ GEM rack (>= 1.0.0) rack-ssl (1.3.4) rack - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) rails (3.1.12) actionmailer (= 3.1.12) @@ -67,7 +68,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) - rake (10.3.2) + rake (10.4.2) rdoc (3.12.2) json (~> 1.4) rspec (2.14.1) @@ -78,7 +79,7 @@ GEM rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) - sprockets (2.0.4) + sprockets (2.0.5) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) @@ -87,12 +88,17 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.41) + tzinfo (0.3.44) PLATFORMS java DEPENDENCIES + i18n (< 0.7) + jruby-openssl (~> 0.9.20) rails (~> 3.1.12) - rake (~> 10.3.1) + rake (~> 10.4.2) rspec (~> 2.14.1) + +BUNDLED WITH + 1.14.6 diff --git a/gemfiles/rails32.gemfile b/gemfiles/rails32.gemfile index 26cad906..34a0b91a 100644 --- a/gemfiles/rails32.gemfile +++ b/gemfiles/rails32.gemfile @@ -2,7 +2,9 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test +gem "jruby-openssl", "~> 0.9.20", :group=>:test +gem "i18n", "< 0.7" gem "rails", "~> 3.2.21" diff --git a/gemfiles/rails32.gemfile.lock b/gemfiles/rails32.gemfile.lock index 40f5fdf0..5cbb592f 100644 --- a/gemfiles/rails32.gemfile.lock +++ b/gemfiles/rails32.gemfile.lock @@ -1,12 +1,12 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.21) - actionpack (= 3.2.21) + actionmailer (3.2.22) + actionpack (= 3.2.22) mail (~> 2.5.4) - actionpack (3.2.21) - activemodel (= 3.2.21) - activesupport (= 3.2.21) + actionpack (3.2.22) + activemodel (= 3.2.22) + activesupport (= 3.2.22) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -14,18 +14,18 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.21) - activesupport (= 3.2.21) + activemodel (3.2.22) + activesupport (= 3.2.22) builder (~> 3.0.0) - activerecord (3.2.21) - activemodel (= 3.2.21) - activesupport (= 3.2.21) + activerecord (3.2.22) + activemodel (= 3.2.22) + activesupport (= 3.2.22) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.21) - activemodel (= 3.2.21) - activesupport (= 3.2.21) - activesupport (3.2.21) + activeresource (3.2.22) + activemodel (= 3.2.22) + activesupport (= 3.2.22) + activesupport (3.2.22) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) arel (3.0.3) @@ -35,36 +35,37 @@ GEM hike (1.2.3) i18n (0.7.0) journey (1.0.4) - json (1.8.2-java) + jruby-openssl (0.9.21-java) + json (1.8.3-java) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - multi_json (1.11.0) + multi_json (1.11.1) polyglot (0.3.5) - rack (1.4.5) + rack (1.4.7) rack-cache (1.2) rack (>= 0.4) rack-ssl (1.3.4) rack rack-test (0.6.3) rack (>= 1.0) - rails (3.2.21) - actionmailer (= 3.2.21) - actionpack (= 3.2.21) - activerecord (= 3.2.21) - activeresource (= 3.2.21) - activesupport (= 3.2.21) + rails (3.2.22) + actionmailer (= 3.2.22) + actionpack (= 3.2.22) + activerecord (= 3.2.22) + activeresource (= 3.2.22) + activesupport (= 3.2.22) bundler (~> 1.0) - railties (= 3.2.21) - railties (3.2.21) - actionpack (= 3.2.21) - activesupport (= 3.2.21) + railties (= 3.2.22) + railties (3.2.22) + actionpack (= 3.2.22) + activesupport (= 3.2.22) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (10.3.2) + rake (10.4.2) rdoc (3.12.2) json (~> 1.4) rspec (2.14.1) @@ -84,293 +85,6 @@ GEM tilt (1.4.1) treetop (1.4.15) polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) - polyglot (>= 0.3.1) polyglot (>= 0.3.1) tzinfo (0.3.44) @@ -378,6 +92,11 @@ PLATFORMS java DEPENDENCIES + i18n (< 0.7) + jruby-openssl (~> 0.9.20) rails (~> 3.2.21) - rake (~> 10.3.1) + rake (~> 10.4.2) rspec (~> 2.14.1) + +BUNDLED WITH + 1.14.6 diff --git a/gemfiles/rails40.gemfile b/gemfiles/rails40.gemfile index b1932544..debd7a5d 100644 --- a/gemfiles/rails40.gemfile +++ b/gemfiles/rails40.gemfile @@ -2,7 +2,8 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test +gem "jruby-openssl", "~> 0.9.20", :group=>:test gem "rails", "~> 4.0.13" diff --git a/gemfiles/rails40.gemfile.lock b/gemfiles/rails40.gemfile.lock index 4e3e4c7d..5d3715d8 100644 --- a/gemfiles/rails40.gemfile.lock +++ b/gemfiles/rails40.gemfile.lock @@ -30,12 +30,13 @@ GEM diff-lcs (1.2.5) erubis (2.7.0) i18n (0.7.0) + jruby-openssl (0.9.21-java) mail (2.6.3) mime-types (>= 1.16, < 3) - mime-types (2.5) + mime-types (2.6.1) minitest (4.7.5) - multi_json (1.11.0) - rack (1.5.2) + multi_json (1.11.1) + rack (1.5.5) rack-test (0.6.3) rack (>= 1.0) rails (4.0.13) @@ -51,7 +52,7 @@ GEM activesupport (= 4.0.13) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.3.2) + rake (10.4.2) rspec (2.14.1) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) @@ -60,9 +61,9 @@ GEM rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) - sprockets (3.0.2) + sprockets (3.2.0) rack (~> 1.0) - sprockets-rails (2.2.4) + sprockets-rails (2.3.2) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) @@ -74,6 +75,10 @@ PLATFORMS java DEPENDENCIES + jruby-openssl (~> 0.9.20) rails (~> 4.0.13) - rake (~> 10.3.1) + rake (~> 10.4.2) rspec (~> 2.14.1) + +BUNDLED WITH + 1.14.6 diff --git a/gemfiles/rails41.gemfile b/gemfiles/rails41.gemfile index 4c85f2aa..28928149 100644 --- a/gemfiles/rails41.gemfile +++ b/gemfiles/rails41.gemfile @@ -2,7 +2,8 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test -gem "rails", "~> 4.1.10" +gem "jruby-openssl", "~> 0.9.20", :group=>:test +gem "rails", "~> 4.1.16" diff --git a/gemfiles/rails41.gemfile.lock b/gemfiles/rails41.gemfile.lock index 9b374054..e223b9be 100644 --- a/gemfiles/rails41.gemfile.lock +++ b/gemfiles/rails41.gemfile.lock @@ -1,61 +1,63 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.10) - actionpack (= 4.1.10) - actionview (= 4.1.10) + actionmailer (4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.10) - actionview (= 4.1.10) - activesupport (= 4.1.10) + actionpack (4.1.16) + actionview (= 4.1.16) + activesupport (= 4.1.16) rack (~> 1.5.2) rack-test (~> 0.6.2) - actionview (4.1.10) - activesupport (= 4.1.10) + actionview (4.1.16) + activesupport (= 4.1.16) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.10) - activesupport (= 4.1.10) + activemodel (4.1.16) + activesupport (= 4.1.16) builder (~> 3.1) - activerecord (4.1.10) - activemodel (= 4.1.10) - activesupport (= 4.1.10) + activerecord (4.1.16) + activemodel (= 4.1.16) + activesupport (= 4.1.16) arel (~> 5.0.0) - activesupport (4.1.10) + activesupport (4.1.16) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) arel (5.0.1.20140414130214) - builder (3.2.2) + builder (3.2.3) + concurrent-ruby (1.0.5-java) diff-lcs (1.2.5) erubis (2.7.0) i18n (0.7.0) - json (1.8.2-java) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.5) - minitest (5.6.0) - rack (1.5.2) + jruby-openssl (0.9.21-java) + json (1.8.6-java) + mail (2.6.6) + mime-types (>= 1.16, < 4) + mime-types (2.6.2) + minitest (5.10.3) + rack (1.5.5) rack-test (0.6.3) rack (>= 1.0) - rails (4.1.10) - actionmailer (= 4.1.10) - actionpack (= 4.1.10) - actionview (= 4.1.10) - activemodel (= 4.1.10) - activerecord (= 4.1.10) - activesupport (= 4.1.10) + rails (4.1.16) + actionmailer (= 4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) + activemodel (= 4.1.16) + activerecord (= 4.1.16) + activesupport (= 4.1.16) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.10) + railties (= 4.1.16) sprockets-rails (~> 2.0) - railties (4.1.10) - actionpack (= 4.1.10) - activesupport (= 4.1.10) + railties (4.1.16) + actionpack (= 4.1.16) + activesupport (= 4.1.16) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.3.2) + rake (10.4.2) rspec (2.14.1) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) @@ -64,21 +66,26 @@ GEM rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) - sprockets (3.0.2) - rack (~> 1.0) - sprockets-rails (2.2.4) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (2.3.3) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - thor (0.19.1) - thread_safe (0.3.5-java) - tzinfo (1.2.2) + thor (0.19.4) + thread_safe (0.3.6-java) + tzinfo (1.2.3) thread_safe (~> 0.1) PLATFORMS java DEPENDENCIES - rails (~> 4.1.10) - rake (~> 10.3.1) + jruby-openssl (~> 0.9.20) + rails (~> 4.1.16) + rake (~> 10.4.2) rspec (~> 2.14.1) + +BUNDLED WITH + 1.14.6 diff --git a/gemfiles/rails42.gemfile b/gemfiles/rails42.gemfile index 114569a6..de51d434 100644 --- a/gemfiles/rails42.gemfile +++ b/gemfiles/rails42.gemfile @@ -2,7 +2,9 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test -gem "rails", "~> 4.2.1" +gem "jruby-openssl", "~> 0.9.20", :group=>:test +gem "mime-types", "< 3", :require=>false +gem "rails", "~> 4.2.9" diff --git a/gemfiles/rails42.gemfile.lock b/gemfiles/rails42.gemfile.lock index 8e94e936..c7cc62ad 100644 --- a/gemfiles/rails42.gemfile.lock +++ b/gemfiles/rails42.gemfile.lock @@ -1,84 +1,84 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.1) - actionpack (= 4.2.1) - actionview (= 4.2.1) - activejob (= 4.2.1) + actionmailer (4.2.9) + actionpack (= 4.2.9) + actionview (= 4.2.9) + activejob (= 4.2.9) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.1) - actionview (= 4.2.1) - activesupport (= 4.2.1) + actionpack (4.2.9) + actionview (= 4.2.9) + activesupport (= 4.2.9) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.1) - activesupport (= 4.2.1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.9) + activesupport (= 4.2.9) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - activejob (4.2.1) - activesupport (= 4.2.1) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (4.2.9) + activesupport (= 4.2.9) globalid (>= 0.3.0) - activemodel (4.2.1) - activesupport (= 4.2.1) + activemodel (4.2.9) + activesupport (= 4.2.9) builder (~> 3.1) - activerecord (4.2.1) - activemodel (= 4.2.1) - activesupport (= 4.2.1) + activerecord (4.2.9) + activemodel (= 4.2.9) + activesupport (= 4.2.9) arel (~> 6.0) - activesupport (4.2.1) + activesupport (4.2.9) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.0) - builder (3.2.2) + arel (6.0.4) + builder (3.2.3) + concurrent-ruby (1.0.5-java) diff-lcs (1.2.5) erubis (2.7.0) - globalid (0.3.5) - activesupport (>= 4.1.0) - i18n (0.7.0) - json (1.8.2-java) - loofah (2.0.1) + globalid (0.4.0) + activesupport (>= 4.2.0) + i18n (0.8.6) + jruby-openssl (0.9.21-java) + loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.5) - minitest (5.6.0) - nokogiri (1.6.6.2-java) - rack (1.6.0) + mail (2.6.6) + mime-types (>= 1.16, < 4) + mime-types (2.99) + minitest (5.10.3) + nokogiri (1.8.0-java) + rack (1.6.8) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.1) - actionmailer (= 4.2.1) - actionpack (= 4.2.1) - actionview (= 4.2.1) - activejob (= 4.2.1) - activemodel (= 4.2.1) - activerecord (= 4.2.1) - activesupport (= 4.2.1) + rails (4.2.9) + actionmailer (= 4.2.9) + actionpack (= 4.2.9) + actionview (= 4.2.9) + activejob (= 4.2.9) + activemodel (= 4.2.9) + activerecord (= 4.2.9) + activesupport (= 4.2.9) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.1) + railties (= 4.2.9) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.6) + rails-dom-testing (1.0.8) activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) + nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) + rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.1) - actionpack (= 4.2.1) - activesupport (= 4.2.1) + railties (4.2.9) + actionpack (= 4.2.9) + activesupport (= 4.2.9) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.3.2) + rake (10.4.2) rspec (2.14.1) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) @@ -87,21 +87,27 @@ GEM rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) - sprockets (3.0.2) - rack (~> 1.0) - sprockets-rails (2.2.4) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - thor (0.19.1) - thread_safe (0.3.5-java) - tzinfo (1.2.2) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + thor (0.19.4) + thread_safe (0.3.6-java) + tzinfo (1.2.3) thread_safe (~> 0.1) PLATFORMS java DEPENDENCIES - rails (~> 4.2.1) - rake (~> 10.3.1) + jruby-openssl (~> 0.9.20) + mime-types (< 3) + rails (~> 4.2.9) + rake (~> 10.4.2) rspec (~> 2.14.1) + +BUNDLED WITH + 1.14.6 diff --git a/gemfiles/railsNG.gemfile b/gemfiles/railsNG.gemfile index e20572c8..17a24553 100644 --- a/gemfiles/railsNG.gemfile +++ b/gemfiles/railsNG.gemfile @@ -2,8 +2,7 @@ source "https://rubygems.org" -gem "rake", "~> 10.3.1", :group=>:test, :require=>nil +gem "rake", "~> 10.4.2", :group=>:test, :require=>nil gem "rspec", "~> 2.14.1", :group=>:test -gem "rails", :github=>"rails/rails", :branch=>"master" -gem "arel", :github=>"rails/arel", :branch=>"master" +gem "rails", "5.0.0.beta1" diff --git a/gemfiles/railsNG.gemfile.lock b/gemfiles/railsNG.gemfile.lock new file mode 100644 index 00000000..8a77f951 --- /dev/null +++ b/gemfiles/railsNG.gemfile.lock @@ -0,0 +1,165 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.0.0.beta1) + actionpack (= 5.0.0.beta1) + celluloid (~> 0.17.2) + coffee-rails (~> 4.1.0) + em-hiredis (~> 0.3.0) + faye-websocket (~> 0.10.0) + redis (~> 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.beta1) + actionpack (= 5.0.0.beta1) + actionview (= 5.0.0.beta1) + activejob (= 5.0.0.beta1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (5.0.0.beta1) + actionview (= 5.0.0.beta1) + activesupport (= 5.0.0.beta1) + rack (~> 2.x) + rack-test (~> 0.6.3) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.0.0.beta1) + activesupport (= 5.0.0.beta1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (5.0.0.beta1) + activesupport (= 5.0.0.beta1) + globalid (>= 0.3.6) + activemodel (5.0.0.beta1) + activesupport (= 5.0.0.beta1) + builder (~> 3.1) + activerecord (5.0.0.beta1) + activemodel (= 5.0.0.beta1) + activesupport (= 5.0.0.beta1) + arel (~> 7.0) + activesupport (5.0.0.beta1) + concurrent-ruby (~> 1.0) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + method_source + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (7.0.0) + builder (3.2.2) + celluloid (0.17.3) + celluloid-essentials + celluloid-extras + celluloid-fsm + celluloid-pool + celluloid-supervision + timers (>= 4.1.1) + celluloid-essentials (0.20.5) + timers (>= 4.1.1) + celluloid-extras (0.20.5) + timers (>= 4.1.1) + celluloid-fsm (0.20.5) + timers (>= 4.1.1) + celluloid-pool (0.20.5) + timers (>= 4.1.1) + celluloid-supervision (0.20.5) + timers (>= 4.1.1) + coffee-rails (4.1.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.1.x) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.10.0) + concurrent-ruby (1.0.0-java) + diff-lcs (1.2.5) + em-hiredis (0.3.0) + eventmachine (~> 1.0) + hiredis (~> 0.5.0) + erubis (2.7.0) + eventmachine (1.0.9.1-java) + execjs (2.6.0) + faye-websocket (0.10.2) + eventmachine (>= 0.12.0) + websocket-driver (>= 0.5.1) + globalid (0.3.6) + activesupport (>= 4.1.0) + hiredis (0.5.2-java) + hitimes (1.2.3-java) + i18n (0.7.0) + json (1.8.3-java) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + method_source (0.8.2) + mime-types (2.99) + minitest (5.8.4) + nokogiri (1.6.7.2-java) + rack (2.0.0.alpha) + json + rack-test (0.6.3) + rack (>= 1.0) + rails (5.0.0.beta1) + actioncable (= 5.0.0.beta1) + actionmailer (= 5.0.0.beta1) + actionpack (= 5.0.0.beta1) + actionview (= 5.0.0.beta1) + activejob (= 5.0.0.beta1) + activemodel (= 5.0.0.beta1) + activerecord (= 5.0.0.beta1) + activesupport (= 5.0.0.beta1) + bundler (>= 1.3.0, < 2.0) + railties (= 5.0.0.beta1) + sprockets-rails (>= 2.0.0) + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (5.0.0.beta1) + actionpack (= 5.0.0.beta1) + activesupport (= 5.0.0.beta1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + redis (3.2.2) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.8) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.6) + sprockets (3.5.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.0.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + thor (0.19.1) + thread_safe (0.3.5-java) + timers (4.1.1) + hitimes + tzinfo (1.2.2) + thread_safe (~> 0.1) + websocket-driver (0.6.3-java) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) + +PLATFORMS + java + +DEPENDENCIES + rails (= 5.0.0.beta1) + rake (~> 10.4.2) + rspec (~> 2.14.1) + +BUNDLED WITH + 1.11.2 diff --git a/pom.xml b/pom.xml index 4b86e806..11827f80 100644 --- a/pom.xml +++ b/pom.xml @@ -212,6 +212,11 @@ + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + org.jruby.maven bundler-maven-plugin @@ -257,6 +262,17 @@ + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + ossrh + https://oss.sonatype.org/ + false + + org.codehaus.mojo versions-maven-plugin @@ -299,6 +315,9 @@ jar + + ${javadoc.opts} + @@ -319,7 +338,15 @@ + + java8-disable-doclint + + [1.8,) + + + -Xdoclint:none + + - diff --git a/src/main/java/org/jruby/rack/AbstractRackDispatcher.java b/src/main/java/org/jruby/rack/AbstractRackDispatcher.java index 41fbd2a0..155ffb09 100644 --- a/src/main/java/org/jruby/rack/AbstractRackDispatcher.java +++ b/src/main/java/org/jruby/rack/AbstractRackDispatcher.java @@ -46,10 +46,10 @@ protected void handleException( final RackResponseEnvironment response) throws IOException { if ( response.isCommitted() ) { - context.log(RackLogger.ERROR, "couldn't handle exception "+ e +" : response is committed"); + context.log(RackLogger.ERROR, "couldn't handle exception (response is committed)", e); return; } - context.log(RackLogger.DEBUG, "resetting rack response due exception"); + context.log(RackLogger.INFO, "resetting rack response due exception: " + e); response.reset(); afterException(request, e, response); diff --git a/src/main/java/org/jruby/rack/servlet/ResponseCapture.java b/src/main/java/org/jruby/rack/servlet/ResponseCapture.java index 3569af15..6fce178c 100644 --- a/src/main/java/org/jruby/rack/servlet/ResponseCapture.java +++ b/src/main/java/org/jruby/rack/servlet/ResponseCapture.java @@ -12,8 +12,11 @@ import java.io.PrintWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.HashSet; +import java.util.Set; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; @@ -233,12 +236,14 @@ public boolean isHandled(final HttpServletRequest request) { // not to happen but there's all kind of beasts out there return false; } + // Tomcat's DefaultServlet sets 'Allow' header but Jetty also sets the 'Date' header with its servlet + // ... if any other headers occur beside 'Allow' and 'Date' we consider this request handled for ( final String headerName : headerNames ) { - if ( ! "Allow".equals( headerName ) ) { - return handled = true; // not just Allow header - consider handled + if ( ! "Allow".equals( headerName ) && ! "Date".equals( headerName ) ) { + return handled = true; } } - return false; // OPTIONS with only Allow header set - unhandled + return false; // OPTIONS with only 'Allow' (and/or 'Date') header set - unhandled } return handled = true; } diff --git a/src/main/ruby/jruby/rack/app_layout.rb b/src/main/ruby/jruby/rack/app_layout.rb index 7ff3342f..7d7ac0f2 100644 --- a/src/main/ruby/jruby/rack/app_layout.rb +++ b/src/main/ruby/jruby/rack/app_layout.rb @@ -1,4 +1,5 @@ #-- +# Copyright (c) 2012-2016 Karol Bucek, LTD. # Copyright (c) 2010-2012 Engine Yard, Inc. # Copyright (c) 2007-2009 Sun Microsystems, Inc. # This source code is available under the MIT license. diff --git a/src/main/ruby/jruby/rack/booter.rb b/src/main/ruby/jruby/rack/booter.rb index b3cafef4..2d359d26 100644 --- a/src/main/ruby/jruby/rack/booter.rb +++ b/src/main/ruby/jruby/rack/booter.rb @@ -1,4 +1,5 @@ #-- +# Copyright (c) 2012-2016 Karol Bucek, LTD. # Copyright (c) 2010-2012 Engine Yard, Inc. # Copyright (c) 2007-2009 Sun Microsystems, Inc. # This source code is available under the MIT license. @@ -92,8 +93,8 @@ def logger; JRuby::Rack.logger; end def boot! adjust_gem_path ENV['RACK_ENV'] = rack_env - export_global_settings change_working_directory + export_global_settings load_settings_from_init_rb set_relative_url_root run_boot_hooks diff --git a/src/main/ruby/jruby/rack/capture.rb b/src/main/ruby/jruby/rack/capture.rb index c17a841b..deee065a 100644 --- a/src/main/ruby/jruby/rack/capture.rb +++ b/src/main/ruby/jruby/rack/capture.rb @@ -128,12 +128,5 @@ def capture end end - module Native - def capture - super - output.puts "\n--- Java Exception" - cause.printStackTrace java.io.PrintStream.new(output.to_outputstream) - end - end end end diff --git a/src/main/ruby/jruby/rack/core_ext.rb b/src/main/ruby/jruby/rack/core_ext.rb index 0f4a3070..77e5c925 100644 --- a/src/main/ruby/jruby/rack/core_ext.rb +++ b/src/main/ruby/jruby/rack/core_ext.rb @@ -22,7 +22,3 @@ class Exception class LoadError include JRuby::Rack::Capture::LoadPath end - -class NativeException - include JRuby::Rack::Capture::Native -end diff --git a/src/main/ruby/jruby/rack/error_app.rb b/src/main/ruby/jruby/rack/error_app.rb index d64d9c9e..2ae0a639 100644 --- a/src/main/ruby/jruby/rack/error_app.rb +++ b/src/main/ruby/jruby/rack/error_app.rb @@ -11,7 +11,11 @@ class ErrorApp autoload :ShowStatus, 'jruby/rack/error_app/show_status' + # @private + InterruptedException = Java::JavaLang::InterruptedException + EXCEPTION = org.jruby.rack.RackEnvironment::EXCEPTION + DEFAULT_EXCEPTION_DETAIL = '' DEFAULT_RESPONSE_CODE = 500 DEFAULT_MIME = 'text/plain' @@ -22,6 +26,8 @@ class ErrorApp # org.jruby.rack.RackInitializationException ] + ALLOW_METHODS = 'HEAD, GET, POST, PUT, DELETE, OPTIONS' + attr_reader :root def initialize(root = nil) @@ -35,8 +41,7 @@ def initialize(root = nil) def call(env) if env['REQUEST_METHOD'] == 'OPTIONS' - allow_methods = 'HEAD, GET, POST, PUT, DELETE, OPTIONS' - return [ 200, {'Allow' => allow_methods, 'Content-Length' => '0'}, [] ] + return [ 200, {'Allow' => ALLOW_METHODS, 'Content-Length' => '0'}, [] ] end code = response_code(env) @@ -56,7 +61,14 @@ def call(env) def response_code(env) if exc = env[EXCEPTION] - env['rack.showstatus.detail'] = exc.message rescue '' + unless env.key?(key = 'rack.showstatus.detail') + begin + env[key] = exc.message || DEFAULT_EXCEPTION_DETAIL + rescue => e + env[key] = DEFAULT_EXCEPTION_DETAIL + warn e.inspect + end + end map_error_code(exc) else nil @@ -85,10 +97,9 @@ def serve(code, path, env) protected def map_error_code(exc) - cause = exc.respond_to?(:cause) ? exc.cause : nil if UNAVAILABLE_EXCEPTIONS.any? { |type| exc.kind_of?(type) } 503 # Service Unavailable - elsif cause.kind_of?(Java::JavaLang::InterruptedException) + elsif exc.respond_to?(:cause) && exc.cause.kind_of?(InterruptedException) 503 # Service Unavailable else 500 @@ -106,6 +117,8 @@ def respond(status = nil, body = nil, headers = DEFAULT_HEADERS) class FileBody + CHUNK_SIZE = 8192 + attr_reader :path, :size alias to_path path @@ -115,7 +128,7 @@ def each File.open(@path, "rb") do |file| # file.seek(0) remaining = @size || (1.0 / 0) - chunk_size = 8192 + chunk_size = CHUNK_SIZE while remaining > 0 chunk_size = remaining if remaining < chunk_size break unless part = file.read(chunk_size) @@ -141,13 +154,21 @@ def expand_path(path, root = self.root) begin require 'rack/utils' + Utils = ::Rack::Utils + + if ''.respond_to?(:bytesize) # Ruby >= 1.9 + def Utils.bytesize(string); string.bytesize end + else + def Utils.bytesize(string); string.size end + end unless defined? Utils.bytesize + require 'rack/mime' rescue LoadError; end - if defined? Rack::Utils.best_q_match + if defined? Utils.best_q_match def accepts_html?(env) - Rack::Utils.best_q_match(env['HTTP_ACCEPT'], %w[text/html]) + Utils.best_q_match(env['HTTP_ACCEPT'], %w[text/html]) rescue http_accept?(env, 'text/html') end diff --git a/src/main/ruby/jruby/rack/error_app/show_status.rb b/src/main/ruby/jruby/rack/error_app/show_status.rb index 0f2b6685..289fe393 100644 --- a/src/main/ruby/jruby/rack/error_app/show_status.rb +++ b/src/main/ruby/jruby/rack/error_app/show_status.rb @@ -5,26 +5,26 @@ class JRuby::Rack::ErrorApp # catches empty responses and replaces them with a site explaining the error. # # @note kindly adapted from on Rack::ShowStatus - # @private internal API - likely won't exist in 1.2.x + # @private internal API - likely won't exist in 1.2 class ShowStatus def initialize(app) require 'rack/request'; require 'rack/utils' - @app = app - @template = ERB.new(TEMPLATE) + @app = app; @template = ERB.new(TEMPLATE, nil, '-') end def call(env) status, headers, body = @app.call(env) - headers = ::Rack::Utils::HeaderHash.new(headers) + headers = Utils::HeaderHash.new(headers) empty = headers['Content-Length'].to_i <= 0 + detail = env['rack.showstatus.detail'] # client or server error, or explicit message - if (status.to_i >= 400 && empty) || env["rack.showstatus.detail"] + if (status.to_i >= 400 && empty) || detail # required erb template variables (captured with binding) : - req = req = ::Rack::Request.new(env) - message = ::Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s - detail = detail = env["rack.showstatus.detail"] || message + request = req = ::Rack::Request.new(env); request && req # avoid un-used warning + message = Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s + detail = detail.nil? ? message : detail # false for no detail body = @template.result(binding) size = body.bytesize @@ -36,12 +36,7 @@ def call(env) # @private def h(obj) - case obj - when String - ::Rack::Utils.escape_html(obj) - else - ::Rack::Utils.escape_html(obj.inspect) - end + obj.is_a?(String) ? Utils.escape_html(obj) : Utils.escape_html(obj.inspect) end # :stopdoc: @@ -55,7 +50,7 @@ def h(obj) - <%=h message %> at <%=h req.script_name + req.path_info %> + <%=h message %> at <%=h request.script_name + request.path_info %>