Add timeout to socket operations for libcurl.