[ticket/13227] Properly handle curlwrapper headers in remote avatars

Read a bit of the file to ensure header values are populated and then
handle headers in the nested array structure too.

PHPBB3-13227
Merge pull request #3085 from naderman/ticket/13227

[ticket/13227] Properly handle curlwrapper headers in remote avatars