httpservices/src/main/java/ucar/httpservices/HTTPAuthUtil.java
static boolean
    authscopeCompatible(AuthScope ss, AuthScope ms)
    {
        assert (ss.getScheme() != null && ms.getScheme() != null);
        if(!ss.getHost().equalsIgnoreCase(ms.getHost()))
            return false;
        if(ss.getPort() != ms.getPort())
            return false;
        String sss = ss.getScheme().toLowerCase();
        String mss = ms.getScheme().toLowerCase();
        if(!sss.equals(mss)) {
            // Do some special casing
            if(sss.endsWith("s")) sss = sss.substring(0, sss.length() - 1);
            if(mss.endsWith("s")) mss = mss.substring(0, mss.length() - 1);
            if(!sss.equals(mss))
                return false;
        }
        return true;
    }
static boolean
    authscopeCompatible(AuthScope ss, AuthScope ms)
    {
        assert (ss.getScheme() != null && ms.getScheme() != null);
        if(!ss.getHost().equalsIgnoreCase(ms.getHost()))
            return false;
        if(ss.getPort() != ms.getPort())
            return false;
        String sss = ss.getScheme().toLowerCase();
        String mss = ms.getScheme().toLowerCase();
        if(!sss.equals(mss)) {
            // Do some special casing
            if(sss.endsWith("s")) sss = sss.substring(0, sss.length() - 1);
            if(mss.endsWith("s")) mss = mss.substring(0, mss.length() - 1);
            if(!sss.equals(mss))
                return false;
        }
        return true;
    }
static boolean authscopeCompatible ( AuthScope ss , AuthScope ms ) { assert ( ss . getScheme ( ) != null && ms . getScheme ( ) != null ) ; if ( ! ss . getHost ( ) . equalsIgnoreCase ( ms . getHost ( ) ) ) return false ; if ( ss . getPort ( ) != ms . getPort ( ) ) return false ; String sss = ss . getScheme ( ) . toLowerCase ( ) ; String mss = ms . getScheme ( ) . toLowerCase ( ) ; if ( ! sss . equals ( mss ) ) { // Do some special casing if ( sss . endsWith ( "s" ) ) sss = sss . substring ( 0 , sss . length ( ) - 1 ) ; if ( mss . endsWith ( "s" ) ) mss = mss . substring ( 0 , mss . length ( ) - 1 ) ; if ( ! sss . equals ( mss ) ) return false ; } return true ; }
Given a session url AuthScope and a Method url AuthScope,
Indicate it the are "compatible" as defined as follows.
The method AuthScope is <i>compatible</i> with the session AuthScope
if its host+port is the same as the session's host+port and its scheme is
compatible, where e.g. http is compatible with https.
The scope realm is ignored.

@param ss Session AuthScope
@param ms Method AuthScope
@return
Given a session url AuthScope and a Method url AuthScope Indicate it the are compatible as defined as follows . The method AuthScope is <i > compatible< / i > with the session AuthScope if its host + port is the same as the session s host + port and its scheme is compatible where e . g . http is compatible with https . The scope realm is ignored .