mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 10:13:14 -05:00
plugin/{forward,proxy}: check for truncated (#1644)
Check for trunacted in the lookup function as well and use the Match function here as well.
This commit is contained in:
@@ -31,15 +31,22 @@ func (f *Forward) Forward(state request.Request) (*dns.Msg, error) {
|
||||
}
|
||||
|
||||
ret, err := proxy.connect(context.Background(), state, f.forceTCP, true)
|
||||
|
||||
ret, err = truncated(ret, err)
|
||||
|
||||
if err != nil {
|
||||
if fails < len(f.proxies) {
|
||||
continue
|
||||
}
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
// Check if the reply is correct; if not return FormErr.
|
||||
if !state.Match(ret) {
|
||||
return state.ErrorMessage(dns.RcodeFormatError), nil
|
||||
}
|
||||
|
||||
return ret, err
|
||||
}
|
||||
return nil, errNoHealthy
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user