CURLOPT_HEADERFUNCTION is the recommended method for collecting the
response headers. Because every request in the redirect chain contains
headers (at the minimum a location line), we can track which URL’s
headers are being parsed and collect a history of URLs.