lib/curl: update and clean up the callback system