lib/rack/file.rb in rack-0.2.0 vs lib/rack/file.rb in rack-0.3.0
- old
+ new
@@ -22,15 +22,16 @@
def _call(env)
if env["PATH_INFO"].include? ".."
return [403, {"Content-Type" => "text/plain"}, ["Forbidden\n"]]
end
- @path = F.join(@root, env["PATH_INFO"])
+ @path = F.join(@root, Utils.unescape(env["PATH_INFO"]))
ext = F.extname(@path)[1..-1]
if F.file?(@path) && F.readable?(@path)
[200, {
+ "Last-Modified" => F.mtime(@path).rfc822,
"Content-Type" => MIME_TYPES[ext] || "text/plain",
"Content-Length" => F.size(@path).to_s
}, self]
else
return [404, {"Content-Type" => "text/plain"},
@@ -70,9 +71,10 @@
"htm" => "text/html",
"html" => "text/html",
"jpe" => "image/jpeg",
"jpeg" => "image/jpeg",
"jpg" => "image/jpeg",
+ "js" => "text/javascript",
"lha" => "application/octet-stream",
"lzh" => "application/octet-stream",
"mov" => "video/quicktime",
"mpe" => "video/mpeg",
"mpeg" => "video/mpeg",