httpservices/src/main/java/ucar/httpservices/HTTPAuthUtil.java
static AuthScope
    authscopeUpgrade(AuthScope ss, AuthScope ms)
    {
        assert (HTTPAuthUtil.authscopeCompatible(ss, ms));
        String sss = ss.getScheme().toLowerCase();
        String mss = ms.getScheme().toLowerCase();
        String upgrade = sss;
        if(sss.startsWith("http") && mss.startsWith("http")) {
            if(sss.equals("https") || mss.equals("https"))
                upgrade = "https";
        }
        AuthScope host = new AuthScope(ss.getHost(), ss.getPort(), AuthScope.ANY_REALM, upgrade);
        return host;
    }
static AuthScope
    authscopeUpgrade(AuthScope ss, AuthScope ms)
    {
        assert (HTTPAuthUtil.authscopeCompatible(ss, ms));
        String sss = ss.getScheme().toLowerCase();
        String mss = ms.getScheme().toLowerCase();
        String upgrade = sss;
        if(sss.startsWith("http") && mss.startsWith("http")) {
            if(sss.equals("https") || mss.equals("https"))
                upgrade = "https";
        }
        AuthScope host = new AuthScope(ss.getHost(), ss.getPort(), AuthScope.ANY_REALM, upgrade);
        return host;
    }
static AuthScope authscopeUpgrade ( AuthScope ss , AuthScope ms ) { assert ( HTTPAuthUtil . authscopeCompatible ( ss , ms ) ) ; String sss = ss . getScheme ( ) . toLowerCase ( ) ; String mss = ms . getScheme ( ) . toLowerCase ( ) ; String upgrade = sss ; if ( sss . startsWith ( "http" ) && mss . startsWith ( "http" ) ) { if ( sss . equals ( "https" ) || mss . equals ( "https" ) ) upgrade = "https" ; } AuthScope host = new AuthScope ( ss . getHost ( ) , ss . getPort ( ) , AuthScope . ANY_REALM , upgrade ) ; return host ; }
Given a session url AuthScope and a Method url AuthScope,
return a new AuthScope that is the upgrade/merge of the other two.
Here, upgrade changes the scheme (only) to move http -> https.
Assumes authscopeCompatible() is true.

@param ss Session authScope
@param ms Method authScope
@return upgraded AuthScope.
Given a session url AuthScope and a Method url AuthScope return a new AuthScope that is the upgrade / merge of the other two . Here upgrade changes the scheme ( only ) to move http - > https . Assumes authscopeCompatible () is true .