title: Ruby (not rails) CGI script output file for download
body: <p>I'm trying to get a script to output a zip file for download.</p>
  
  <p>The script is basically:</p>
  
  <pre><code>#!/usr/bin/env ruby
  require 'rubygems'
  require 'active_support'
  require 'zip/zip'
  require 'cgi'
  
  temp_zip_filename = '/some/path/tmp/' + Time.new.usec.to_s
  new_zip = File.open(temp_zip_filename, 'rb'){|f| f.read}
  
  #header = "Content-Type: application/octet-stream"
  #header &lt;&lt; ' Content-Disposition: attachement; filename="AZipFile.zip"'
  
  CGI.new.out 'application/zip' do
    new_zip
  end
  </code></pre>
  
  <p>I can't see anywhere I can set the downloaded file's name on the requesting computer.  It always seems to get saved as "scriptname.cgi".  Where can I set the content disposition with CGI?</p>