Implemented SSL support by copying directly from dotjs.