added conditional ssl support