Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit bf10d313b125e7fde1acaab1fe6492dc32c9a25f 1 parent faafcea
@josh josh authored
Showing with 11 additions and 5 deletions.
  1. +6 −2 lib/rack/directory.rb
  2. +4 −2 lib/rack/file.rb
  3. +1 −1  lib/rack/urlmap.rb
View
8 lib/rack/directory.rb
@@ -71,7 +71,9 @@ def check_forbidden
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 @@ def list_path
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
View
6 lib/rack/file.rb
@@ -45,7 +45,8 @@ def _call(env)
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 @@ def serving
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
View
2  lib/rack/urlmap.rb
@@ -48,7 +48,7 @@ def call(env)
'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
Please sign in to comment.
Something went wrong with that request. Please try again.