How to get HTTP headers before downloading with Ruby's OpenUri
问题 I am currently using OpenURI to download a file in Ruby. Unfortunately, it seems impossible to get the HTTP headers without downloading the full file: open(base_url, :content_length_proc => lambda {|t| if t && 0 < t pbar = ProgressBar.create(:total => t) end }, :progress_proc => lambda {|s| pbar.progress = s if pbar }) {|io| puts io.size puts io.meta['content-disposition'] } Running the code above shows that it first downloads the full file and only then prints the header I need. Is there a