@@ -707,6 +707,13 @@ var parseRequestURLTests = []struct {
707
707
// RFC 6874.
708
708
{"http://[fe80::1%en0]/" , false },
709
709
{"http://[fe80::1%en0]:8080/" , false },
710
+
711
+ {"http://x:x:" , true }, // malformed IPv6 but still accepted
712
+ {"http://x::" , false }, // a colon after empty port is not allowed
713
+ {"http://x:1:" , false }, // a colon after the port is not allowed
714
+ {"http://x:12:" , false }, // a colon after the port is not allowed
715
+ {"http://x:123:" , false }, // a colon after the port is not allowed
716
+ {"http://127.0.0.1:8080:" , false }, // a colon after the port is not allowed
710
717
}
711
718
712
719
func TestParseRequestURI (t * testing.T ) {
@@ -1643,6 +1650,13 @@ func TestParseErrors(t *testing.T) {
1643
1650
{"cache_object:foo" , true },
1644
1651
{"cache_object:foo/bar" , true },
1645
1652
{"cache_object/:foo/bar" , false },
1653
+
1654
+ {"http://x:x:" , false }, // malformed IPv6 but still accepted
1655
+ {"http://x::" , true }, // a colon after empty port is not allowed
1656
+ {"http://x:1:" , true }, // a colon after the port is not allowed
1657
+ {"http://x:12:" , true }, // a colon after the port is not allowed
1658
+ {"http://x:123:" , true }, // a colon after the port is not allowed
1659
+ {"http://127.0.0.1:8080:" , true }, // a colon after the port is not allowed
1646
1660
}
1647
1661
for _ , tt := range tests {
1648
1662
u , err := Parse (tt .in )
0 commit comments