Factorizing duplicated code in ssl_calls