Skip to content

Commit 5771ab2

Browse files
authored
Fix proxy scheme problem to only add scheme when no scheme is provided. (#149)
1 parent 8728917 commit 5771ab2

File tree

1 file changed

+5
-2
lines changed
  • imagetool/src/main/java/com/oracle/weblogic/imagetool/util

1 file changed

+5
-2
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/util/Utils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,11 @@ public static void setProxyIfRequired(String httpProxyUrl, String httpsProxyUrl,
156156
}
157157

158158
private static void setSystemProxy(String proxyUrl, String protocolToSet) throws IOException {
159-
if (!proxyUrl.toLowerCase().startsWith(protocolToSet)) {
160-
proxyUrl = protocolToSet + "://" + proxyUrl;
159+
160+
// If no scheme is set then default to http://
161+
if (!proxyUrl.toLowerCase().startsWith(Constants.HTTP + "://")
162+
&& !proxyUrl.toLowerCase().startsWith(Constants.HTTPS + "://")) {
163+
proxyUrl = Constants.HTTP + "://" + proxyUrl;
161164
}
162165
URL url = new URL(proxyUrl);
163166
String host = url.getHost();

0 commit comments

Comments
 (0)