added ability to degradate to http from https