about summary refs log tree commit homepage
path: root/extras
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-12-30 02:02:21 +0000
committerEric Wong <e@80x24.org>2013-12-30 02:03:36 +0000
commit5535a4e78637c35081d42bf949e3995997ceefcb (patch)
treef5d15859ee12099e697ac1a751aea31305afb2e6 /extras
parent4fe625b9a42b003e31329edd45d087b9c47ef5ed (diff)
downloadyahns-5535a4e78637c35081d42bf949e3995997ceefcb.tar.gz
Proper POSIX filesystems are encoding-agnostic.
Diffstat (limited to 'extras')
-rw-r--r--extras/autoindex.rb2
-rw-r--r--extras/try_gzip_static.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/extras/autoindex.rb b/extras/autoindex.rb
index 9ce6c61..c8f7054 100644
--- a/extras/autoindex.rb
+++ b/extras/autoindex.rb
@@ -42,7 +42,7 @@ class Autoindex
       return res if status.to_i != 404
 
       path_info = env["PATH_INFO"]
-      path_info_ue = Rack::Utils.unescape(path_info)
+      path_info_ue = Rack::Utils.unescape(path_info, Encoding::BINARY)
 
       # reject requests to go up a level (browser takes care of it)
       path_info_ue =~ /\.\./ and return r(403)
diff --git a/extras/try_gzip_static.rb b/extras/try_gzip_static.rb
index b8abb03..d562957 100644
--- a/extras/try_gzip_static.rb
+++ b/extras/try_gzip_static.rb
@@ -33,12 +33,12 @@ class TryGzipStatic
   end
 
   def initialize(root, default_type = 'text/plain')
-    @root = root
+    @root = root.b
     @default_type = default_type
   end
 
   def fspath(env)
-    path_info = Rack::Utils.unescape(env["PATH_INFO"])
+    path_info = Rack::Utils.unescape(env["PATH_INFO"], Encoding::BINARY)
     path_info =~ /\.\./ ? nil : "#@root#{path_info}"
   end