diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-26 11:10:40 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-26 11:10:40 -0600 |
commit | bf10d313b125e7fde1acaab1fe6492dc32c9a25f (patch) | |
tree | f2ac232d02569c78de65cdd3d906092b015217b5 | |
parent | faafcea111bbe60733f5ba6a16539ac0bffb6d40 (diff) | |
download | rack-bf10d313b125e7fde1acaab1fe6492dc32c9a25f.tar.gz |
Tag not found responses from file servers with X-Cascade header
Prepares internal file servers for revised Rack::Cascade that looks for a magic header instead of discarding all 404 responses.
-rw-r--r-- | lib/rack/directory.rb | 8 | ||||
-rw-r--r-- | lib/rack/file.rb | 6 | ||||
-rw-r--r-- | lib/rack/urlmap.rb | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/lib/rack/directory.rb b/lib/rack/directory.rb index acdd3029..927ac0c9 100644 --- a/lib/rack/directory.rb +++ b/lib/rack/directory.rb @@ -71,7 +71,9 @@ table { width:100%%; } body = "Forbidden\n" size = Rack::Utils.bytesize(body) - return [403, {"Content-Type" => "text/plain","Content-Length" => size.to_s}, [body]] + return [403, {"Content-Type" => "text/plain", + "Content-Length" => size.to_s, + "X-Cascade" => "pass"}, [body]] end def list_directory @@ -123,7 +125,9 @@ table { width:100%%; } def entity_not_found body = "Entity not found: #{@path_info}\n" size = Rack::Utils.bytesize(body) - return [404, {"Content-Type" => "text/plain", "Content-Length" => size.to_s}, [body]] + return [404, {"Content-Type" => "text/plain", + "Content-Length" => size.to_s, + "X-Cascade" => "pass"}, [body]] end def each diff --git a/lib/rack/file.rb b/lib/rack/file.rb index fe62bd6b..14af7b3b 100644 --- a/lib/rack/file.rb +++ b/lib/rack/file.rb @@ -45,7 +45,8 @@ module Rack def forbidden body = "Forbidden\n" [403, {"Content-Type" => "text/plain", - "Content-Length" => body.size.to_s}, + "Content-Length" => body.size.to_s, + "X-Cascade" => "pass"}, [body]] end @@ -73,7 +74,8 @@ module Rack def not_found body = "File not found: #{@path_info}\n" [404, {"Content-Type" => "text/plain", - "Content-Length" => body.size.to_s}, + "Content-Length" => body.size.to_s, + "X-Cascade" => "pass"}, [body]] end diff --git a/lib/rack/urlmap.rb b/lib/rack/urlmap.rb index fcf6616c..262dec8d 100644 --- a/lib/rack/urlmap.rb +++ b/lib/rack/urlmap.rb @@ -48,7 +48,7 @@ module Rack 'SCRIPT_NAME' => (script_name + location), 'PATH_INFO' => path[location.size..-1])) } - [404, {"Content-Type" => "text/plain"}, ["Not Found: #{path}"]] + [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{path}"]] end end end |