Function 'ds.login' ammended to verify connection type and apply the correct curl options.