Sha256: 282719126c1b3bfabee6c1e25ef51bc3832956a9da7b44ab582d508c54a6d290
Contents?: true
Size: 772 Bytes
Versions: 8
Compression:
Stored size: 772 Bytes
Contents
require 'time' require 'rack/utils' require 'rack/mime' module DAV4Rack # DAV4Rack::File simply allows us to use Rack::File but with the # specific location we deem appropriate class File < Rack::File attr_accessor :path alias :to_path :path def initialize(path) @path = path end def _call(env) begin if F.file?(@path) && F.readable?(@path) serving else raise Errno::EPERM end rescue SystemCallError not_found end end def not_found body = "File not found: #{Utils.unescape(env["PATH_INFO"])}\n" [404, {"Content-Type" => "text/plain", "Content-Length" => body.size.to_s, "X-Cascade" => "pass"}, [body]] end end end
Version data entries
8 entries across 8 versions & 1 rubygems