Catch SSL and HTTPErrors and retry at most 3 times, after, raise the exception

Refs #339.