exported mg_terminate_ssl