Write response headers to a stream resource and make CURLOPT_HEADER optional