protected boolean matchNonProxy ( final Proxy proxy , final String hostname ) { String host = hostname ; if ( null == hostname ) host = IGitHubConstants . HOST_DEFAULT ; // IGitHubConstants.HOST_API; // code from org.apache.maven.plugins.site.AbstractDeployMojo#getProxyInfo final String nonProxyHosts = proxy . getNonProxyHosts ( ) ; if ( null != nonProxyHosts ) { final String [ ] nonProxies = nonProxyHosts . split ( "(,)|(;)|(\\|)" ) ; if ( null != nonProxies ) { for ( final String nonProxyHost : nonProxies ) { //if ( StringUtils.contains( nonProxyHost, "*" ) ) if ( null != nonProxyHost && nonProxyHost . contains ( "*" ) ) { // Handle wildcard at the end, beginning or middle of the nonProxyHost final int pos = nonProxyHost . indexOf ( ' ' ) ; String nonProxyHostPrefix = nonProxyHost . substring ( 0 , pos ) ; String nonProxyHostSuffix = nonProxyHost . substring ( pos + 1 ) ; // prefix* if ( ! StringUtils . isEmpty ( nonProxyHostPrefix ) && host . startsWith ( nonProxyHostPrefix ) && StringUtils . isEmpty ( nonProxyHostSuffix ) ) { return true ; } // *suffix if ( StringUtils . isEmpty ( nonProxyHostPrefix ) && ! StringUtils . isEmpty ( nonProxyHostSuffix ) && host . endsWith ( nonProxyHostSuffix ) ) { return true ; } // prefix*suffix if ( ! StringUtils . isEmpty ( nonProxyHostPrefix ) && host . startsWith ( nonProxyHostPrefix ) && ! StringUtils . isEmpty ( nonProxyHostSuffix ) && host . endsWith ( nonProxyHostSuffix ) ) { return true ; } } else if ( host . equals ( nonProxyHost ) ) { return true ; } } } } return false ; }
Check hostname that matched nonProxy setting