Update to go1.25.2

This commit is contained in:
Vorapol Rinsatitnon
2025-10-10 07:17:45 +07:00
parent ee27abde31
commit 6d4ee095f5
72 changed files with 1167 additions and 441 deletions

View File

@@ -383,6 +383,16 @@ var urltests = []URLTest{
},
"",
},
// valid IPv6 host with port and path
{
"https://[2001:db8::1]:8443/test/path",
&URL{
Scheme: "https",
Host: "[2001:db8::1]:8443",
Path: "/test/path",
},
"",
},
// host subcomponent; IPv6 address with zone identifier in RFC 6874
{
"http://[fe80::1%25en0]/", // alphanum zone identifier
@@ -707,6 +717,24 @@ var parseRequestURLTests = []struct {
// RFC 6874.
{"http://[fe80::1%en0]/", false},
{"http://[fe80::1%en0]:8080/", false},
// Tests exercising RFC 3986 compliance
{"https://[1:2:3:4:5:6:7:8]", true}, // full IPv6 address
{"https://[2001:db8::a:b:c:d]", true}, // compressed IPv6 address
{"https://[fe80::1%25eth0]", true}, // link-local address with zone ID (interface name)
{"https://[fe80::abc:def%254]", true}, // link-local address with zone ID (interface index)
{"https://[2001:db8::1]/path", true}, // compressed IPv6 address with path
{"https://[fe80::1%25eth0]/path?query=1", true}, // link-local with zone, path, and query
{"https://[::ffff:192.0.2.1]", false},
{"https://[:1] ", false},
{"https://[1:2:3:4:5:6:7:8:9]", false},
{"https://[1::1::1]", false},
{"https://[1:2:3:]", false},
{"https://[ffff::127.0.0.4000]", false},
{"https://[0:0::test.com]:80", false},
{"https://[2001:db8::test.com]", false},
{"https://[test.com]", false},
}
func TestParseRequestURI(t *testing.T) {
@@ -1643,6 +1671,17 @@ func TestParseErrors(t *testing.T) {
{"cache_object:foo", true},
{"cache_object:foo/bar", true},
{"cache_object/:foo/bar", false},
{"http://[192.168.0.1]/", true}, // IPv4 in brackets
{"http://[192.168.0.1]:8080/", true}, // IPv4 in brackets with port
{"http://[::ffff:192.168.0.1]/", true}, // IPv4-mapped IPv6 in brackets
{"http://[::ffff:192.168.0.1]:8080/", true}, // IPv4-mapped IPv6 in brackets with port
{"http://[::ffff:c0a8:1]/", true}, // IPv4-mapped IPv6 in brackets (hex)
{"http://[not-an-ip]/", true}, // invalid IP string in brackets
{"http://[fe80::1%foo]/", true}, // invalid zone format in brackets
{"http://[fe80::1", true}, // missing closing bracket
{"http://fe80::1]/", true}, // missing opening bracket
{"http://[test.com]/", true}, // domain name in brackets
}
for _, tt := range tests {
u, err := Parse(tt.in)