lib/nightcrawler_swift/commands/upload.rb in nightcrawler_swift-0.10.0 vs lib/nightcrawler_swift/commands/upload.rb in nightcrawler_swift-0.11.0
- old
+ new
@@ -4,12 +4,15 @@
def execute path, file, opts = {}
body = file.read
headers = {etag: etag(body), content_type: content_type(file)}
max_age = opts[:max_age] || options.max_age
- headers.merge!(cache_control: "public, max-age=#{max_age}", expires: expires(max_age)) if max_age
+ headers.merge!(cache_control: "public, max-age=#{max_age}") if max_age
+ expires = opts[:expires]
+ headers.merge!(expires: CGI.rfc1123_date(expires)) if expires
+
content_encoding = opts[:content_encoding] || options.content_encoding
headers.merge!(content_encoding: content_encoding.to_s) if content_encoding
custom_headers = opts[:custom_headers]
headers.merge!(custom_headers) if custom_headers
@@ -24,13 +27,9 @@
MultiMime.by_file(file).content_type
end
def etag content
Digest::MD5.hexdigest(content)
- end
-
- def expires max_age
- CGI.rfc1123_date(Time.now + max_age)
end
end
end