Use libcurl instead of curl command for downloading

Previous implementation used for simplifications for downloading curl
command. This instead implements download using libcurl.
5 jobs for libcurl
in 5 minutes and 36 seconds and was queued for 2 minutes and 47 seconds