support ssl partial_chain feature

Please fix the indentation, and provide something better than fun() if that exists. Thanks!