]> gitweb.michael.orlitzky.com - dead/whatever-dl.git/blobdiff - src/wget_downloader.rb
Allow the downloaders to take advantage of the websites' headers.
[dead/whatever-dl.git] / src / wget_downloader.rb
index 825ee12b9865f556733e4d05078036990d068fff..ce4c760b5f2784c67db4ee2fcf2fe1951bb252da 100644 (file)
@@ -18,7 +18,7 @@
 
 class WgetDownloader < Downloader
 
-  def download(url, outfile, continue=false)
+  def download(url, outfile, headers = {}, continue = false)
     if (continue == false and File.exists?(outfile))
       raise IOError.new("Output file already exists. Please remove #{outfile}, and try again. If this is a partially-downloaded file, you can use the --continue flag to pick up where it left off.")
     end
@@ -26,7 +26,11 @@ class WgetDownloader < Downloader
     options = ''
 
     if continue == true
-      options += '--continue'
+      options += '--continue '
+    end
+
+    headers.each_key do |key|
+      options += "--header '#{key}: #{headers[key]}' "
     end
 
     # This one's easy.