Index: E:/Projets/OSS/wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/proxy/ProxyInfo.java =================================================================== --- E:/Projets/OSS/wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/proxy/ProxyInfo.java (revision 420520) +++ E:/Projets/OSS/wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/proxy/ProxyInfo.java (working copy) @@ -17,6 +17,7 @@ */ import org.apache.maven.wagon.WagonConstants; +import org.codehaus.plexus.util.StringUtils; import java.io.Serializable; @@ -205,4 +206,35 @@ { return ntlmDomain; } + + /** + * Checks if a host is the nonProxyHost list or not.
+ * Currently only support * as a wildcard beginning a nonProxyHost. + * TODO support other wildcard position in the nonProxyHost list + * @param host the host to be checked + * @return true if the host is the nonProxyHost, false otherwise. + */ + public boolean isNonProxyHost(String host) + { + String httpNonProxyHosts = this.getNonProxyHosts(); + if (StringUtils.isEmpty(httpNonProxyHosts)) + { + return false; + } + String[] nonProxyHosts = httpNonProxyHosts.split("\\|"); + for (int i = 0; i < nonProxyHosts.length; ++i) + { + if (nonProxyHosts[i].startsWith("*")) + { + if (host.endsWith(nonProxyHosts[i].substring(1))) + { + return true; + } + } else if (host.equals(nonProxyHosts[i])) + { + return true; + } + } + return false; + } }