/usr/lib/ruby/vendor_ruby/merb-core/rack/middleware/conditional_get.rb is in ruby-merb-core 1.1.3+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | module Merb
module Rack
class ConditionalGet < Merb::Rack::Middleware
# :api: plugin
def call(env)
status, headers, body = @app.call(env)
if document_not_modified?(env, headers)
status = 304
body = Merb::Const::EMPTY_STRING
# set Date header using RFC1123 date format as specified by HTTP
# RFC2616 section 3.3.1.
end
[status, headers, body]
end
private
# :api: private
def document_not_modified?(env, headers)
if etag = headers[Merb::Const::ETAG]
etag == env[Merb::Const::HTTP_IF_NONE_MATCH]
elsif last_modified = headers[Merb::Const::LAST_MODIFIED]
last_modified == env[Merb::Const::HTTP_IF_MODIFIED_SINCE]
end
end
end
end
end
|