clay 1.5 → 1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/src/clay.rb +1 -1
- data/src/rack/clay.rb +5 -9
- metadata +3 -3
data/src/clay.rb
CHANGED
data/src/rack/clay.rb
CHANGED
@@ -33,13 +33,14 @@ module Rack
|
|
33
33
|
request = Request.new(env)
|
34
34
|
path_info = request.path_info
|
35
35
|
@files = ::Dir[@path + "/**/*"].inspect
|
36
|
+
path_info += ".html" if @files.include?(path_info+".html")
|
36
37
|
if @files.include?(path_info)
|
37
38
|
if path_info =~ /(\/?)$/
|
38
39
|
if @mimes.collect {|regex| path_info =~ regex }.compact.empty?
|
39
40
|
path_info += $1.nil? ? "/index.html" : "index.html"
|
40
41
|
end
|
41
42
|
end
|
42
|
-
|
43
|
+
mime_type = mime(path_info)
|
43
44
|
|
44
45
|
file = file_info(@path + path_info)
|
45
46
|
body = file[:body]
|
@@ -48,17 +49,12 @@ module Rack
|
|
48
49
|
if time == request.env['HTTP_IF_MODIFIED_SINCE']
|
49
50
|
[304, {'Last-Modified' => time}, []]
|
50
51
|
else
|
51
|
-
[200, {"Content-Type" =>
|
52
|
+
[200, {"Content-Type" => mime_type, "Content-length" => body.length.to_s, 'Last-Modified' => time}, [body]]
|
52
53
|
end
|
53
|
-
|
54
54
|
else
|
55
55
|
status, body, path_info = ::File.exist?(@path+"/404.html") ? [404,file_info(@path+"/404.html")[:body],"404.html"] : [404,"Not found","404.html"]
|
56
|
-
|
57
|
-
|
58
|
-
[status, {"Content-Type" => mime, "Content-length" => body.length.to_s}, [body]]
|
59
|
-
else
|
60
|
-
[200, {"Content-Type" => "text/plain"}, ["This site is currently generating pages. Please reload this page after 10 secs."]]
|
61
|
-
end
|
56
|
+
mime_type = mime(path_info)
|
57
|
+
[status, {"Content-Type" => mime_type, "Content-length" => body.length.to_s}, [body]]
|
62
58
|
end
|
63
59
|
end
|
64
60
|
|
metadata
CHANGED