Gavriel Fleischer
2015-07-30 12:16:26 UTC
Hi,
I am trying to copy a file into the cloud (both to SoftLayer and to AWS)
and I need to preserve the "Last-Modified" header, so when I retrieve it
back from the clouds I would see the last_modified time I provided.
I can't figure out how to do it. I tried it in these ways:
dir = s3.directories.get("mybucket")
last_modified = Time.at(1437600000)
dir.files.create(key: "file2.txt", body: "content string", last_modified:
last_modified.httpdate)
dir.files.create(key: "file2.txt", body: "content string", last_modified:
last_modified)
dir.files.create(key: "file2.txt", body: "content string", 'Last-Modified'
=> last_modified)
dir.files.create(key: "file2.txt", body: "content string", 'Last-Modified'
=> last_modified.httpdate)
path = "/tmp/to_upload.txt"
File.open(path, "w+") { |file|
file.write("content string")
}
FileUtils.touch(path, mtime: last_modified)
dir.files.create(key: key, body: open(path))
I am trying to copy a file into the cloud (both to SoftLayer and to AWS)
and I need to preserve the "Last-Modified" header, so when I retrieve it
back from the clouds I would see the last_modified time I provided.
I can't figure out how to do it. I tried it in these ways:
dir = s3.directories.get("mybucket")
last_modified = Time.at(1437600000)
dir.files.create(key: "file2.txt", body: "content string", last_modified:
last_modified.httpdate)
dir.files.create(key: "file2.txt", body: "content string", last_modified:
last_modified)
dir.files.create(key: "file2.txt", body: "content string", 'Last-Modified'
=> last_modified)
dir.files.create(key: "file2.txt", body: "content string", 'Last-Modified'
=> last_modified.httpdate)
path = "/tmp/to_upload.txt"
File.open(path, "w+") { |file|
file.write("content string")
}
FileUtils.touch(path, mtime: last_modified)
dir.files.create(key: key, body: open(path))
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.