From 7008dfba6660d71463d0b82b20ac70e652174325 Mon Sep 17 00:00:00 2001
From: Toshi MARUYAMA <marutosijp2@yahoo.co.jp>
Date: Tue, 7 Apr 2015 08:35:02 +0900
Subject: Gemfile: temporay pin "bcrypt" version and run "bundle update bcrypt"
 on Linux

Related: #19617, #19187, #19533, #19689, #19675.

This is POC (Proof Of Concept) which bundler does not remove mingw lines.
https://github.com/rails/rails/pull/19617#issuecomment-90293795
---
 Gemfile      |  2 +-
 Gemfile.lock | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Gemfile b/Gemfile
index 0d2498a79e..ddaaacdc59 100644
--- a/Gemfile
+++ b/Gemfile
@@ -22,7 +22,7 @@ gem 'sprockets', '~> 3.0.0.rc.1'
 # require: false so bcrypt is loaded only when has_secure_password is used.
 # This is to avoid ActiveModel (and by extension the entire framework)
 # being dependent on a binary library.
-gem 'bcrypt', '~> 3.1.7', require: false
+gem 'bcrypt', '~> 3.1.10', require: false
 
 # This needs to be with require false to avoid
 # it being automatically loaded by sprockets
diff --git a/Gemfile.lock b/Gemfile.lock
index 82111e1eb3..543cfaf3da 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -99,6 +99,8 @@ GEM
       beaneater (~> 0.3.1)
       dante (~> 0.1.5)
     bcrypt (3.1.10)
+    bcrypt (3.1.10-x64-mingw32)
+    bcrypt (3.1.10-x86-mingw32)
     beaneater (0.3.3)
     benchmark-ips (2.1.1)
     builder (3.2.2)
@@ -126,6 +128,7 @@ GEM
     globalid (0.3.3)
       activesupport (>= 4.1.0)
     hitimes (1.2.2)
+    hitimes (1.2.2-x86-mingw32)
     i18n (0.7.0)
     json (1.8.2)
     kindlerb (0.1.1)
@@ -147,6 +150,10 @@ GEM
     mysql2 (0.3.18)
     nokogiri (1.6.6.2)
       mini_portile (~> 0.6.0)
+    nokogiri (1.6.6.2-x64-mingw32)
+      mini_portile (~> 0.6.0)
+    nokogiri (1.6.6.2-x86-mingw32)
+      mini_portile (~> 0.6.0)
     pg (0.18.1)
     psych (2.0.13)
     que (0.9.2)
@@ -240,6 +247,8 @@ GEM
 
 PLATFORMS
   ruby
+  x64-mingw32
+  x86-mingw32
 
 DEPENDENCIES
   activerecord-jdbcmysql-adapter (>= 1.3.0)
@@ -247,7 +256,7 @@ DEPENDENCIES
   activerecord-jdbcsqlite3-adapter (>= 1.3.0)
   arel!
   backburner
-  bcrypt (~> 3.1.7)
+  bcrypt (~> 3.1.10)
   benchmark-ips
   coffee-rails (~> 4.1.0)
   dalli (>= 2.2.1)
-- 
cgit v1.2.3


From 2a73b5999e27e4c6dd052013bf814c6be965f56a Mon Sep 17 00:00:00 2001
From: Toshi MARUYAMA <marutosijp2@yahoo.co.jp>
Date: Fri, 27 Mar 2015 21:01:54 +0900
Subject: wrap "require 'drb/unix'" by bgin-end at test/abstract_unit.rb

Related: #19617, #19187, #19533, #19689, #19675.

'drb/unix' does not exist on mingw.
---
 actionpack/test/abstract_unit.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 62ff1be5c9..c1be2c9afe 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -14,7 +14,11 @@ silence_warnings do
 end
 
 require 'drb'
-require 'drb/unix'
+begin
+  require 'drb/unix'
+rescue LoadError
+  puts "'drb/unix' is not available"
+end
 require 'tempfile'
 
 PROCESS_COUNT = (ENV['N'] || 4).to_i
-- 
cgit v1.2.3


From 7e504927090362d132d4e315c6f22915050fe5ba Mon Sep 17 00:00:00 2001
From: Toshi MARUYAMA <marutosijp2@yahoo.co.jp>
Date: Fri, 27 Mar 2015 03:46:19 +0900
Subject: [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
---
 .../lib/action_dispatch/middleware/static.rb       |  2 +-
 actionpack/test/dispatch/static_test.rb            | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb
index fdd1bc4e69..9a92b690c7 100644
--- a/actionpack/lib/action_dispatch/middleware/static.rb
+++ b/actionpack/lib/action_dispatch/middleware/static.rb
@@ -28,7 +28,7 @@ module ActionDispatch
       paths = [path, "#{path}#{ext}", "#{path}/index#{ext}"]
 
       if match = paths.detect { |p|
-        path = File.join(@root, p)
+        path = File.join(@root, p.force_encoding('UTF-8'))
         begin
           File.file?(path) && File.readable?(path)
         rescue SystemCallError
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
-- 
cgit v1.2.3