"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "parse_test.go" between
dns-1.1.47.tar.gz and dns-1.1.48.tar.gz

About: GO DNS implements a DNS library in Go.

parse_test.go  (dns-1.1.47):parse_test.go  (dns-1.1.48)
skipping to change at line 1642 skipping to change at line 1642
t.Errorf("`%s' should be equal to\n`%s', but is `%s'" , s, o, rr.String()) t.Errorf("`%s' should be equal to\n`%s', but is `%s'" , s, o, rr.String())
} }
} }
} }
func TestParseSVCB(t *testing.T) { func TestParseSVCB(t *testing.T) {
svcbs := map[string]string{ svcbs := map[string]string{
`example.com. 3600 IN SVCB 0 cloudflare.com.`: `example.com. 3 600 IN SVCB 0 cloudflare.com.`, `example.com. 3600 IN SVCB 0 cloudflare.com.`: `example.com. 3 600 IN SVCB 0 cloudflare.com.`,
`example.com. 3600 IN SVCB 65000 cloudflare.com. alpn=h2 ipv4hint =3.4.3.2`: `example.com. 3600 IN SVCB 65000 cloudflare.com. alp n="h2" ipv4hint="3.4.3.2"`, `example.com. 3600 IN SVCB 65000 cloudflare.com. alpn=h2 ipv4hint =3.4.3.2`: `example.com. 3600 IN SVCB 65000 cloudflare.com. alp n="h2" ipv4hint="3.4.3.2"`,
`example.com. 3600 IN SVCB 65000 cloudflare.com. key65000=4\ 3 ke y65001="\" " key65002 key65003= key65004="" key65005== key65006==\"\" key65007=\ 254 key65008=\032`: `example.com. 3600 IN SVCB 65000 cloudflare. com. key65000="4\ 3" key65001="\"\ " key65002="" key65003="" key65004="" key6500 5="=" key65006="=\"\"" key65007="\254" key65008="\ "`, `example.com. 3600 IN SVCB 65000 cloudflare.com. key65000=4\ 3 ke y65001="\" " key65002 key65003= key65004="" key65005== key65006==\"\" key65007=\ 254 key65008=\032`: `example.com. 3600 IN SVCB 65000 cloudflare. com. key65000="4\ 3" key65001="\"\ " key65002="" key65003="" key65004="" key6500 5="=" key65006="=\"\"" key65007="\254" key65008="\ "`,
// Explained in svcb.go "In AliasMode, records SHOULD NOT include
any SvcParams,"
`example.com. 3600 IN SVCB 0 no-default-alpn`: `example.com. 3
600 IN SVCB 0 no-default-alpn.`,
// From the specification
`example.com. HTTPS 0 foo.example.com.`: `example.com. 3
600 IN HTTPS 0 foo.example.com.`,
`example.com. SVCB 1 .`: `example.com. 3600 IN S
VCB 1 .`,
`example.com. SVCB 16 foo.example.com. port=53`: `example.com
. 3600 IN SVCB 16 foo.example.com. port="53"`,
`example.com. SVCB 1 foo.example.com. key667=hello`: `example
.com. 3600 IN SVCB 1 foo.example.com. key667="hello"`,
`example.com. SVCB 1 foo.example.com. key667="hello\210qoo"`:
`example.com. 3600 IN SVCB 1 foo.example.com. key667="hello\210qoo"`
,
`example.com. SVCB 1 foo.example.com. ipv6hint="2001:db8::1,2
001:db8::53:1"`: `example.com. 3600 IN SVCB 1 foo.example.com. ipv6hi
nt="2001:db8::1,2001:db8::53:1"`,
`example.com. SVCB 1 example.com. ipv6hint="2001:db8::198.51.
100.100"`: `example.com. 3600 IN SVCB 1 example.com. ipv6hint="
2001:db8::c633:6464"`,
`example.com. SVCB 16 foo.example.org. alpn=h2,h3-19 mandator
y=ipv4hint,alpn ipv4hint=192.0.2.1`: `example.com. 3600 IN SVCB 1
6 foo.example.org. alpn="h2,h3-19" mandatory="ipv4hint,alpn" ipv4hint="192.0.2.1
"`,
`example.com. SVCB 16 foo.example.org. alpn="f\\\\oo\\,bar,h2
"`: `example.com. 3600 IN SVCB 16 foo.example.org. alpn="f\\\\oo
\\,bar,h2"`,
`example.com. SVCB 16 foo.example.org. alpn=f\\\092oo\092,bar
,h2`: `example.com. 3600 IN SVCB 16 foo.example.org. alpn="f\\\092
oo\092,bar,h2"`,
} }
for s, o := range svcbs { for s, o := range svcbs {
rr, err := NewRR(s) rr, err := NewRR(s)
if err != nil { if err != nil {
t.Error("failed to parse RR: ", err) t.Error("failed to parse RR: ", err)
continue continue
} }
if rr.String() != o { if rr.String() != o {
t.Errorf("`%s' should be equal to\n`%s', but is `%s'" , s, o, rr.String()) t.Errorf("`%s' should be equal to\n`%s', but is `%s'" , s, o, rr.String())
} }
} }
} }
func TestParseBadSVCB(t *testing.T) { func TestParseBadSVCB(t *testing.T) {
header := `example.com. 3600 IN HTTPS ` header := `example.com. 3600 IN HTTPS `
evils := []string{ evils := []string{
`0 . no-default-alpn`, // aliasform
`65536 . no-default-alpn`, // bad priority `65536 . no-default-alpn`, // bad priority
`1 ..`, // bad domain `1 ..`, // bad domain
`1 . no-default-alpn=1`, // value illegal `1 . no-default-alpn=1`, // value illegal
`1 . key`, // invalid key `1 . key`, // invalid key
`1 . key=`, // invalid key `1 . key=`, // invalid key
`1 . =`, // invalid key `1 . =`, // invalid key
`1 . ==`, // invalid key `1 . ==`, // invalid key
`1 . =a`, // invalid key `1 . =a`, // invalid key
`1 . ""`, // invalid key `1 . ""`, // invalid key
`1 . ""=`, // invalid key `1 . ""=`, // invalid key
skipping to change at line 1685 skipping to change at line 1697
`1 . key65534="`, // unterminated value `1 . key65534="`, // unterminated value
`1 . key65534=\2`, // invalid numeric escape `1 . key65534=\2`, // invalid numeric escape
`1 . key65534=\24`, // invalid numeric escape `1 . key65534=\24`, // invalid numeric escape
`1 . key65534=\256`, // invalid numeric escape `1 . key65534=\256`, // invalid numeric escape
`1 . key65534=\`, // invalid numeric escape `1 . key65534=\`, // invalid numeric escape
`1 . key65534=""alpn`, // zQuote ending needs whitespace `1 . key65534=""alpn`, // zQuote ending needs whitespace
`1 . key65534="a"alpn`, // zQuote ending needs whitespace `1 . key65534="a"alpn`, // zQuote ending needs whitespace
`1 . ipv6hint=1.1.1.1`, // not ipv6 `1 . ipv6hint=1.1.1.1`, // not ipv6
`1 . ipv6hint=1:1:1:1`, // not ipv6 `1 . ipv6hint=1:1:1:1`, // not ipv6
`1 . ipv6hint=a`, // not ipv6 `1 . ipv6hint=a`, // not ipv6
`1 . ipv6hint=`, // empty ipv6
`1 . ipv4hint=1.1.1.1.1`, // not ipv4 `1 . ipv4hint=1.1.1.1.1`, // not ipv4
`1 . ipv4hint=::fc`, // not ipv4 `1 . ipv4hint=::fc`, // not ipv4
`1 . ipv4hint=..11`, // not ipv4 `1 . ipv4hint=..11`, // not ipv4
`1 . ipv4hint=a`, // not ipv4 `1 . ipv4hint=a`, // not ipv4
`1 . ipv4hint=`, // empty ipv4
`1 . port=`, // empty port `1 . port=`, // empty port
`1 . echconfig=YUd`, // bad base64 `1 . echconfig=YUd`, // bad base64
} }
for _, o := range evils { for _, o := range evils {
_, err := NewRR(header + o) _, err := NewRR(header + o)
if err == nil { if err == nil {
t.Error("failed to reject invalid RR: ", header+o) t.Error("failed to reject invalid RR: ", header+o)
continue continue
} }
} }
 End of changes. 4 change blocks. 
1 lines changed or deleted 34 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)