about summary refs log tree commit homepage
path: root/extras
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-07-03 23:21:14 +0000
committerEric Wong <e@80x24.org>2016-07-05 20:38:01 +0000
commit97ef2a9c592fbdb756aa6a73e2e6c90b6b3cda18 (patch)
tree41759197b5af676d5ad101505bc9d026812fe868 /extras
parent405435825e90c5f79209946ecd8fc842519b42ba (diff)
downloadyahns-97ef2a9c592fbdb756aa6a73e2e6c90b6b3cda18.tar.gz
This is mainly to benefit curl(1) users who forget to use '-f'
to show failures.  Not sure if I want to keep this change, it
seems like bloat; but Rack::ShowStatus pages are totally
overkill...
Diffstat (limited to 'extras')
-rw-r--r--extras/autoindex.rb5
-rw-r--r--extras/try_gzip_static.rb5
2 files changed, 6 insertions, 4 deletions
diff --git a/extras/autoindex.rb b/extras/autoindex.rb
index 4deb3ef..238edd9 100644
--- a/extras/autoindex.rb
+++ b/extras/autoindex.rb
@@ -168,8 +168,9 @@ class Autoindex
     if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include?(code)
       [ code, {}, [] ]
     else
-      h = { 'Content-Type' => 'text/plain', 'Content-Length' => '0' }
-      [ code, h, [] ]
+      msg = "#{code} #{Rack::Utils::HTTP_STATUS_CODES[code.to_i]}\n"
+      h = { 'Content-Type' => 'text/plain', 'Content-Length' => msg.size.to_s }
+      [ code, h, [ msg ] ]
     end
   end
 
diff --git a/extras/try_gzip_static.rb b/extras/try_gzip_static.rb
index ed561cb..d412589 100644
--- a/extras/try_gzip_static.rb
+++ b/extras/try_gzip_static.rb
@@ -216,8 +216,9 @@ class TryGzipStatic
     if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include?(code)
       [ code, {}, [] ]
     else
-      h = { 'Content-Type' => 'text/plain', 'Content-Length' => '0' }
-      [ code, h, [] ]
+      msg = "#{code} #{Rack::Utils::HTTP_STATUS_CODES[code.to_i]}\n"
+      h = { 'Content-Type' => 'text/plain', 'Content-Length' => msg.size.to_s }
+      [ code, h, [ msg ] ]
     end
   end
 end