(cherry picked from commit 6fcc06bf72cf3b95c30f04919e807c7aaacec68d) (cherry picked just the libcurl stuff)