about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--extras/try_gzip_static.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/extras/try_gzip_static.rb b/extras/try_gzip_static.rb
index d562957..4279e65 100644
--- a/extras/try_gzip_static.rb
+++ b/extras/try_gzip_static.rb
@@ -92,7 +92,9 @@ class TryGzipStatic
     path = fspath(env) or return r(403)
     begin
       st = File.stat(path)
-      st.file? ? [ path, st ] : r(404)
+      return r(404) unless st.file?
+      return r(403) unless st.readable?
+      [ path, st ]
     rescue Errno::ENOENT, Errno::ENOTDIR
       r(404)
     rescue Errno::EACCES