class WWW::Mechanize::File

def initialize(uri=nil, response=nil, body=nil, code=nil)

def initialize(uri=nil, response=nil, body=nil, code=nil)
  @uri, @body, @code = uri, body, code
  @response = Headers.new
  # Copy the headers in to a hash to prevent memory leaks
  if response
    response.each { |k,v|
      @response[k] = v
    }
  end
  @filename = 'index.html'
  # Set the filename
  if disposition = @response['content-disposition']
    disposition.split(/;\s*/).each do |pair|
      k,v = pair.split(/=/, 2)
      @filename = v if k.downcase == 'filename'
    end
  else
    if @uri
      @filename = @uri.path.split(/\//).last || 'index.html'
      @filename << ".html" unless @filename =~ /\./
    end
  end
  yield self if block_given?
end