Commit 1deb8f2c authored by Eric Roman's avatar Eric Roman Committed by Commit Bot

Add an explanation and test for IPv6 range proxy bypass rules.

The expectation is that the IPv6 literal not be bracketed.

Change-Id: I90631a55cddf1c02684512c8e9989f6d21cdc174
Reviewed-on: https://chromium-review.googlesource.com/c/1327528Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606667}
parent 6c41f5e5
...@@ -161,15 +161,28 @@ class NET_EXPORT ProxyBypassRules { ...@@ -161,15 +161,28 @@ class NET_EXPORT ProxyBypassRules {
// Examples: // Examples:
// "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99" // "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
// //
// (4) IP_LITERAL "/" PREFIX_LENGTH_IN_BITS // (4) IPV4_LITERAL "/" PREFIX_LENGTH_IN_BITS
// //
// Match any URL that is to an IP literal that falls between the // Match any URL that is an IPv4 literal that falls between the
// given range. IP range is specified using CIDR notation. // given range.
// //
// Examples: // Examples:
// "192.168.1.1/16", "fefe:13::abc/33". // "192.168.1.1/16"
// //
// (5) "<local>" // (5) IPV6_LITERAL "/" PREFIX_LENGTH_IN_BITS
//
// Match any URL that is an IPv6 literal that falls between the given
// range.
//
// Note that IPV6_LITERAL must *not* be bracketed. "[fefe::/40]" for
// instance is not valid, but "fefe::/40" is. This notation comes from
// macOS's proxy bypass rules which supports IPv6 (Windows bypass rules do
// not).
//
// Examples:
// "fefe:13::abc/33".
//
// (6) "<local>"
// //
// Matches the bypass rule in Windows of the same name, which essentially // Matches the bypass rule in Windows of the same name, which essentially
// means hostnames without a period in them, as well as "127.0.0.1", // means hostnames without a period in them, as well as "127.0.0.1",
...@@ -177,7 +190,7 @@ class NET_EXPORT ProxyBypassRules { ...@@ -177,7 +190,7 @@ class NET_EXPORT ProxyBypassRules {
// //
// TODO(https://crbug.com/902579): Fix. // TODO(https://crbug.com/902579): Fix.
// //
// (6) "<-loopback>" // (7) "<-loopback>"
// //
// Subtracts the implicit proxy bypass rules (localhost and link local // Subtracts the implicit proxy bypass rules (localhost and link local
// addresses), so they are no longer bypassed. // addresses), so they are no longer bypassed.
......
...@@ -394,6 +394,17 @@ TEST(ProxyBypassRulesTest, ParseAndMatchCIDR_IPv6) { ...@@ -394,6 +394,17 @@ TEST(ProxyBypassRulesTest, ParseAndMatchCIDR_IPv6) {
EXPECT_FALSE(rules.Matches(GURL("http://192.169.1.1"))); EXPECT_FALSE(rules.Matches(GURL("http://192.169.1.1")));
} }
// Test that parsing an IPv6 range given a bracketed literal is not supported.
// Whether IPv6 literals need to be bracketed or not is pretty much a coin toss
// depending on the context, and here it is expected to be unbracketed to match
// macOS. It would be fine to support bracketed too, however none of the
// grammars we parse need that.
TEST(ProxyBypassRulesTest, ParseBracketedIPv6Range) {
ProxyBypassRules rules;
rules.ParseFromString("[a:b:c:d::]/48");
ASSERT_EQ(0u, rules.rules().size());
}
// Check which URLs an empty ProxyBypassRules matches. // Check which URLs an empty ProxyBypassRules matches.
TEST(ProxyBypassRulesTest, DefaultImplicitRules) { TEST(ProxyBypassRulesTest, DefaultImplicitRules) {
ProxyBypassRules rules; ProxyBypassRules rules;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment