Sha256: 3d7571e0181244b31b9f34accbd78afef6f6e177cb1e13c8d0b4ded56fd1e284

Contents?: true

Size: 1.35 KB

Versions: 13

Compression:

Stored size: 1.35 KB

Contents

# Copyright (c) 2008 The Committers

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

require 'time'

module Rack
  class Date

    def initialize(app, no_cache_control = nil, cache_control = nil)
      @app = app
    end

    def call(env)
      status, headers, body = @app.call(env)
      headers['Date'] = Time.new.httpdate if not headers['Date']
      [status, headers, body]
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
deltacloud-core-1.1.3 lib/sinatra/rack_date.rb
deltacloud-core-1.1.2 lib/sinatra/rack_date.rb
deltacloud-core-1.1.1 lib/sinatra/rack_date.rb
deltacloud-core-1.1.0 lib/sinatra/rack_date.rb
deltacloud-core-1.0.5 lib/sinatra/rack_date.rb
deltacloud-core-1.0.4 lib/sinatra/rack_date.rb
deltacloud-core-1.0.3 lib/sinatra/rack_date.rb
deltacloud-core-1.0.2 lib/sinatra/rack_date.rb
deltacloud-core-1.0.1 lib/sinatra/rack_date.rb
deltacloud-core-1.0.0 lib/sinatra/rack_date.rb
deltacloud-core-0.5.0 lib/sinatra/rack_date.rb
deltacloud-core-0.4.1 lib/sinatra/rack_date.rb
deltacloud-core-0.4.0 lib/sinatra/rack_date.rb