diff --git a/msg.go b/msg.go index 43a6bbe7..393121a3 100644 --- a/msg.go +++ b/msg.go @@ -109,7 +109,7 @@ var Rr_str = map[uint16]string{ TypeOPT: "OPT", TypeDS: "DS", TypeDHCID: "DHCID", - TypeHIP: "HIP" + TypeHIP: "HIP", TypeIPSECKEY: "IPSECKEY", TypeSSHFP: "SSHFP", TypeRRSIG: "RRSIG", diff --git a/parse_test.go b/parse_test.go index c51b6577..62536483 100644 --- a/parse_test.go +++ b/parse_test.go @@ -410,6 +410,7 @@ moutamassey NS ns01.yahoodomains.jp. } } +// www.example.com. 3600 IN HIP 2 200100107B1A74DF365639CC39F1D578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbWIy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+bSRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D rvs.example.com func ExampleHIP() { h := `www.example.com. IN HIP ( 2 200100107B1A74DF365639CC39F1D578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p diff --git a/zscan.go b/zscan.go index 70002fe0..1a7e3d89 100644 --- a/zscan.go +++ b/zscan.go @@ -562,13 +562,12 @@ func zlexer(s scanner.Scanner, c chan lex) { // discard // this means it can also not be used as rdata case '\n': - // hmmm, escape newline + // Escaped newline if quote { str[stri] = byte(x[0]) stri++ break } - // inside quotes this is legal escape = false if commt { @@ -585,36 +584,28 @@ func zlexer(s scanner.Scanner, c chan lex) { } break } - if stri != 0 { - l.value = _STRING - l.token = string(str[:stri]) - if !rrtype { - if _, ok := Str_rr[strings.ToUpper(l.token)]; ok { - l.value = _RRTYPE - rrtype = true - } - } - c <- l - } - if brace > 0 { - l.value = _BLANK - l.token = " " - if !space { - c <- l - } - } else { + + if brace == 0 { + // If there is previous text, we should output it here + if stri != 0 { + l.value = _STRING + l.token = string(str[:stri]) + if !rrtype { + if _, ok := Str_rr[strings.ToUpper(l.token)]; ok { + l.value = _RRTYPE + rrtype = true + } + } + c <- l + } l.value = _NEWLINE l.token = "\n" c <- l - } - if l.value == _BLANK { - space = true - } - - stri = 0 - commt = false - rrtype = false - owner = true + stri = 0 + commt = false + rrtype = false + owner = true + } case '\\': // quote? if commt { diff --git a/zscan_rr.go b/zscan_rr.go index ef257a41..5b62c8aa 100644 --- a/zscan_rr.go +++ b/zscan_rr.go @@ -397,7 +397,7 @@ func setHIP(h RR_Header, c chan lex, o, f string) (RR, *ParseError) { rr := new(RR_HIP) rr.Hdr = h - // HitLength is represented + // HitLength is not represented l := <-c if i, e := strconv.Atoi(l.token); e != nil { return nil, &ParseError{f, "bad HIP PublicKeyAlgorithm", l} @@ -434,7 +434,6 @@ func setHIP(h RR_Header, c chan lex, o, f string) (RR, *ParseError) { l = <-c } rr.RendezvousServers = xs - return rr, nil }