I ran into an issue where curl request run within few ms from command line but same url fetch was taking over 10 secs. After doing some debugging and research it turned out that call to check (getaddr ipv6 was timing out. Obviously you can do multiple things to fix this (including enabling ipv6 support) but since I did not have a need for ipv6 (it is disabled in my network configuration), I decided to recompile curl and disable ipv6. Here is the command for recompiling curl and installing into /usr/local/curl directory with ipv6 disabled.
./configure –prefix=/usr/local/curl –disable-ipv6
————————————-
DISCLAIMER: Please be smart and use code found on internet
carefully. Make backups often. And yeah.. last but not least.. I
am not responsible for any damage caused by this posting.
Use at your own risk.