Fix invalid SNI handling

SNIExtension was previously marshalling both ip addresses and empty
strings, which are not allowed. See RFC 6066, Section 3.

All of the utls specific testdata replays needed to be rebuilt to
properly accomodate this change since they had previously been including
empty server name extension values

Addresses https://github.com/refraction-networking/utls/issues/96
This commit is contained in:
Maxb 2022-02-01 21:01:29 -08:00
parent 0b2885c8c0
commit ee9f86141f
48 changed files with 3445 additions and 3621 deletions

View file

@ -196,6 +196,38 @@ func TestUTLSRemoveSNIExtension(t *testing.T) {
runUTLSClientTestForVersion(t, test, "TLSv12-", "-tls1_2", hello, true)
}
func TestUTLSServerNameIP(t *testing.T) {
hello := &helloID{HelloChrome_70}
config := getUTLSTestConfig()
config.ServerName = "1.1.1.1"
opensslCipherName := "ECDHE-RSA-AES128-GCM-SHA256"
test := &clientTest{
name: "UTLS-" + opensslCipherName + "-" + hello.helloName() + "-ServerNameIP",
args: []string{"-cipher", opensslCipherName},
config: config,
}
runUTLSClientTestForVersion(t, test, "TLSv12-", "-tls1_2", hello, true)
}
func TestUTLSEmptyServerName(t *testing.T) {
hello := &helloID{HelloChrome_70}
config := getUTLSTestConfig()
config.ServerName = ""
opensslCipherName := "ECDHE-RSA-AES128-GCM-SHA256"
test := &clientTest{
name: "UTLS-" + opensslCipherName + "-" + hello.helloName() + "-EmptyServerName",
args: []string{"-cipher", opensslCipherName},
config: config,
}
runUTLSClientTestForVersion(t, test, "TLSv12-", "-tls1_2", hello, true)
}
/*
*
HELPER FUNCTIONS BELOW
@ -212,6 +244,7 @@ func getUTLSTestConfig() *Config {
MinVersion: VersionSSL30,
MaxVersion: VersionTLS13,
CipherSuites: allCipherSuites(),
ServerName: "foobar.com",
}
return testUTLSConfig
}