# File lib/httpclient.rb, line 571
  def default_redirect_uri_callback(uri, res)
    newuri = URI.parse(res.header['location'][0])
    if https?(uri) && !https?(newuri)
      raise BadResponseError.new("redirecting to non-https resource")
    end
    unless newuri.is_a?(URI::HTTP)
      newuri = uri + newuri
      STDERR.puts("could be a relative URI in location header which is not recommended")
      STDERR.puts("'The field value consists of a single absolute URI' in HTTP spec")
    end
    puts "redirect to: #{newuri}" if $DEBUG
    newuri
  end