fetch

in lib/cc/cli/prepare.rb [56:70]


      def fetch(url, target_path)
        ensure_external!(url) unless allow_internal_ips?

        uri = URI.parse(url)
        http = Net::HTTP.new(uri.host, uri.port)
        http.use_ssl = uri.scheme == "https"
        resp = http.get(uri)
        if resp.code == "200"
          write_file(target_path, resp.body)
          say("Wrote #{url} to #{target_path}")
        else
          raise FetchError, "Failed fetching #{url}: code=#{resp.code} body=#{resp.body}"
        end
      end