diff options
author | arvida <arvid@winstondesign.se> | 2011-10-31 10:26:05 +0100 |
---|---|---|
committer | arvida <arvid@winstondesign.se> | 2011-10-31 10:26:05 +0100 |
commit | 964b2826c44888a310488fd3ce297b68e1dbf670 (patch) | |
tree | 8fac23b77852539c26f261e9cd1a3c68ec1ae6f9 /actionpack | |
parent | bb4a79370a0091b7966de7f04f41e0b021adb29e (diff) | |
download | rails-964b2826c44888a310488fd3ce297b68e1dbf670.tar.gz rails-964b2826c44888a310488fd3ce297b68e1dbf670.tar.bz2 rails-964b2826c44888a310488fd3ce297b68e1dbf670.zip |
Added accessor methods for Date header
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/http/cache.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/cache.rb b/actionpack/lib/action_dispatch/http/cache.rb index aaed0d750f..7d83ecb058 100644 --- a/actionpack/lib/action_dispatch/http/cache.rb +++ b/actionpack/lib/action_dispatch/http/cache.rb @@ -56,6 +56,20 @@ module ActionDispatch headers['Last-Modified'] = utc_time.httpdate end + def date + if date_header = headers['Date'] + Time.httpdate(date_header) + end + end + + def date? + headers.include?('Date') + end + + def date=(utc_time) + headers['Date'] = utc_time.httpdate + end + def etag=(etag) key = ActiveSupport::Cache.expand_cache_key(etag) @etag = self["ETag"] = %("#{Digest::MD5.hexdigest(key)}") |