aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/static_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2015-03-27 03:46:19 +0900
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-04-09 19:25:12 -0300
commit7e504927090362d132d4e315c6f22915050fe5ba (patch)
tree394f263d73beba45d474ce02e643e1fe227a0162 /actionpack/test/dispatch/static_test.rb
parent2a73b5999e27e4c6dd052013bf814c6be965f56a (diff)
downloadrails-7e504927090362d132d4e315c6f22915050fe5ba.tar.gz
rails-7e504927090362d132d4e315c6f22915050fe5ba.tar.bz2
rails-7e504927090362d132d4e315c6f22915050fe5ba.zip
[Rails4 regression] prevent thin and puma cause error in Non ASCII URL on Windows
* https://github.com/rails/rails/issues/19187 * https://github.com/rails/rails/pull/19533 * https://github.com/macournoyer/thin/issues/268 These are serious Rails 4 regression for Redmine Bitnami Windows users. https://community.bitnami.com/t/problems-with-3-0-1-installation-see-report-inside/30195/ It is not caused on webrick users. Related: * https://github.com/rack/rack/issues/732#issuecomment-67677272 * https://github.com/phusion/passenger/issues/1328
Diffstat (limited to 'actionpack/test/dispatch/static_test.rb')
-rw-r--r--actionpack/test/dispatch/static_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb
index 288a2084f6..f153030675 100644
--- a/actionpack/test/dispatch/static_test.rb
+++ b/actionpack/test/dispatch/static_test.rb
@@ -2,6 +2,16 @@ require 'abstract_unit'
require 'zlib'
module StaticTests
+ def setup
+ @default_internal_encoding = Encoding.default_internal
+ @default_external_encoding = Encoding.default_external
+ end
+
+ def teardown
+ Encoding.default_internal = @default_internal_encoding
+ Encoding.default_external = @default_external_encoding
+ end
+
def test_serves_dynamic_content
assert_equal "Hello, World!", get("/nofile").body
end
@@ -10,6 +20,16 @@ module StaticTests
assert_equal "Hello, World!", get("/doorkeeper%E3E4").body
end
+ def test_handles_urls_with_ascii_8bit
+ assert_equal "Hello, World!", get("/doorkeeper%E3E4".force_encoding('ASCII-8BIT')).body
+ end
+
+ def test_handles_urls_with_ascii_8bit_on_win_31j
+ Encoding.default_internal = "Windows-31J"
+ Encoding.default_external = "Windows-31J"
+ assert_equal "Hello, World!", get("/doorkeeper%E3E4".force_encoding('ASCII-8BIT')).body
+ end
+
def test_sets_cache_control
response = get("/index.html")
assert_html "/index.html", response
@@ -208,6 +228,7 @@ class StaticTest < ActiveSupport::TestCase
}
def setup
+ super
@root = "#{FIXTURE_LOAD_PATH}/public"
@app = ActionDispatch::Static.new(DummyApp, @root, "public, max-age=60")
end
@@ -237,6 +258,7 @@ end
class StaticEncodingTest < StaticTest
def setup
+ super
@root = "#{FIXTURE_LOAD_PATH}/公共"
@app = ActionDispatch::Static.new(DummyApp, @root, "public, max-age=60")
end