code: def prepare_request_headers(url)
        # set any additional HTTP headers
        headers = @default_headers.dup
  
        unless @host_headers.empty?
          @host_headers.each do |name,header|
            if url.host.match(name)
              headers['Host'] = header
              break
            end
          end
        end
  
        headers['Host']     ||= @host_header if @host_header
        headers['User-Agent'] = @user_agent if @user_agent
        headers['Referer']    = @referer if @referer
  
        if (authorization = @authorized.for_url(url))
          headers['Authorization'] = "Basic #{authorization}"
        end
  
        if (header_cookies = @cookies.for_host(url.host))
          headers['Cookie'] = header_cookies
        end
  
        return headers
      end
docs: Prepares request headers for the given URL.
  
   @param [URI::HTTP] url
     The URL to prepare the request headers for.
  
   @return [Hash{String => String}]
     The prepared headers.
  
   @since 0.6.0