Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-20252] git ignores “no proxy” settings
  • Loading branch information
timothy-volvo authored and ndeloof committed Dec 7, 2013
1 parent 71a368e commit 21a977c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
Expand Up @@ -1468,9 +1468,18 @@ private String getURLWithCrendentials(URIish u, StandardCredentials cred) {
}

if (proxy != null) {
client.getHostConfiguration().setProxy(proxy.name, proxy.port);
if (proxy.getUserName() != null && proxy.getPassword() != null)
client.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(proxy.getUserName(), proxy.getPassword()));
boolean shouldProxy = true;
for(Pattern p : proxy.getNoProxyHostPatterns()) {
if(p.matcher(uri.getHost()).matches()) {
shouldProxy = false;
break;
}
}
if(shouldProxy) {
client.getHostConfiguration().setProxy(proxy.name, proxy.port);
if (proxy.getUserName() != null && proxy.getPassword() != null)
client.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(proxy.getUserName(), proxy.getPassword()));
}
}

List<String> candidates = new ArrayList<String>();
Expand All @@ -1497,7 +1506,7 @@ private String getURLWithCrendentials(URIish u, StandardCredentials cred) {
+ " (status = "+status+")");
} catch (IOException e) {
throw new GitException("Failed to connect to " + u.toString()
+ (cred != null ? " using credentials " + cred.getDescription() : "" ));
+ (cred != null ? " using credentials " + cred.getDescription()));
} catch (IllegalArgumentException e) {
throw new GitException("Invalid URL " + u.toString());
}
Expand Down

0 comments on commit 21a977c

Please sign in to comment.