Fix URI
This commit is contained in:
parent
4ba5ac6863
commit
27c20aff55
2
types.go
2
types.go
|
@ -1144,7 +1144,7 @@ type URI struct {
|
||||||
Hdr RR_Header
|
Hdr RR_Header
|
||||||
Priority uint16
|
Priority uint16
|
||||||
Weight uint16
|
Weight uint16
|
||||||
Target string `dns:"txt"`
|
Target []string `dns:"txt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *URI) Header() *RR_Header { return &rr.Hdr }
|
func (rr *URI) Header() *RR_Header { return &rr.Hdr }
|
||||||
|
|
35
zscan_rr.go
35
zscan_rr.go
|
@ -126,6 +126,8 @@ func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {
|
||||||
return setTLSA(h, c, f)
|
return setTLSA(h, c, f)
|
||||||
case TypeTXT:
|
case TypeTXT:
|
||||||
return setTXT(h, c, f)
|
return setTXT(h, c, f)
|
||||||
|
case TypeURI:
|
||||||
|
return setURI(h, c, f)
|
||||||
case TypeNINFO:
|
case TypeNINFO:
|
||||||
return setNINFO(h, c, f)
|
return setNINFO(h, c, f)
|
||||||
case TypeHIP:
|
case TypeHIP:
|
||||||
|
@ -164,7 +166,7 @@ func endingToString(c chan lex, errstr, f string) (string, *ParseError) {
|
||||||
case _BLANK:
|
case _BLANK:
|
||||||
// Ok
|
// Ok
|
||||||
default:
|
default:
|
||||||
return "", &ParseError{f, "bad DHCID Digest", l}
|
return "", &ParseError{f, errstr, l}
|
||||||
}
|
}
|
||||||
l = <-c
|
l = <-c
|
||||||
}
|
}
|
||||||
|
@ -1660,35 +1662,10 @@ func setURI(h RR_Header, c chan lex, f string) (RR, *ParseError) {
|
||||||
} else {
|
} else {
|
||||||
rr.Weight = uint16(i)
|
rr.Weight = uint16(i)
|
||||||
}
|
}
|
||||||
// _BLANK?
|
|
||||||
|
|
||||||
// Get the remaining data until we see a NEWLINE
|
s, e := endingToTxtSlice(c, "bad URI Target", f)
|
||||||
quote := false
|
if e != nil {
|
||||||
l = <-c
|
return nil, e
|
||||||
var s string
|
|
||||||
switch l.value == _QUOTE {
|
|
||||||
case true:
|
|
||||||
for l.value != _NEWLINE && l.value != _EOF {
|
|
||||||
switch l.value {
|
|
||||||
case _STRING:
|
|
||||||
s += l.token
|
|
||||||
case _BLANK:
|
|
||||||
if quote {
|
|
||||||
// _BLANK can only be seen in between txt parts.
|
|
||||||
return nil, &ParseError{f, "bad URI Target", l}
|
|
||||||
}
|
|
||||||
case _QUOTE:
|
|
||||||
quote = !quote
|
|
||||||
default:
|
|
||||||
return nil, &ParseError{f, "bad URI Target", l}
|
|
||||||
}
|
|
||||||
l = <-c
|
|
||||||
}
|
|
||||||
if quote {
|
|
||||||
return nil, &ParseError{f, "bad URI Target", l}
|
|
||||||
}
|
|
||||||
case false: // Unquoted
|
|
||||||
return nil, &ParseError{f, "bad URI Target", l}
|
|
||||||
}
|
}
|
||||||
rr.Target = s
|
rr.Target = s
|
||||||
return rr, nil
|
return rr, nil
|
||||||
|
|
Loading…
Reference in New Issue