aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Christoph Siedentop <christophsiedentop@gmail.com>2016-08-09 08:07:19 +0000
committerGravatar Yue Gan <yueg@google.com>2016-08-09 09:01:08 +0000
commit1d9761390dddf4d577e06dad790d92f354187a9d (patch)
treee9133df46604b4cdcea701542ee67f5880d50834 /src/main/java/com/google/devtools
parentd3d3266a33335fe232c84a0db4251aefa5bfe2e8 (diff)
ProxyHelper handles proxy URLs with trailing slash.
Having a proxy URL defined with a trailing slash caused an exception. `Proxy address ... is not a valid URL"` This pull request fixes this issue. I also added two test cases for this issue. 1. Trailing slash in proxy URL. 2. No user:password provided in proxy URL. Closes #1597. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/1597 MOS_MIGRATED_REVID=129721433
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelper.java3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelper.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelper.java
index 19e072dfbe..fd0936989c 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/ProxyHelper.java
@@ -15,7 +15,6 @@
package com.google.devtools.build.lib.bazel.repository.downloader;
import com.google.common.base.Strings;
-
import java.io.IOException;
import java.net.Authenticator;
import java.net.InetSocketAddress;
@@ -75,7 +74,7 @@ public class ProxyHelper {
// Here there be dragons.
Pattern urlPattern =
- Pattern.compile("^(https?)://(([^:@]+?)(?::([^@]+?))?@)?([^:]+)(?::(\\d+))?$");
+ Pattern.compile("^(https?)://(([^:@]+?)(?::([^@]+?))?@)?([^:]+)(?::(\\d+))?/?$");
Matcher matcher = urlPattern.matcher(proxyAddress);
if (!matcher.matches()) {
throw new IOException("Proxy address " + proxyAddress + " is not a valid URL");