How to get a remote-file's mtime before downloading it in Ruby?


Cihan Keser

I have the below code, which simply downloads a file and saves it. I want to run it every 30 seconds and check if the remote-file's mtime has changed and download it if it has. I'll be creating a thread which sleeps 30seconds after every iteration of an endless loop for that purpose, but; how do I check a remote file's mtime without downloading it?

Net::HTTP.start($xmlServerHostname) { |http|
resp = http.get($xmlServerPath+"levels.xml")
open("levels.xml", "w") { |file|

Continue reading...