[curl] Add support to handle SSL errors, and give a chance to the user to react.

Reviewed by: Peter Gal