mirror of
https://github.com/coredns/coredns.git
synced 2025-10-31 18:23:13 -04:00
plugin/forward: Return original message on truncation (#1674)
With this change the original truncated message returned by requested server is returned to the client, instead of returning an empty dummy message with only the truncation bit set.
This commit is contained in:
committed by
Miek Gieben
parent
305ae9b9bc
commit
e671e22e65
@@ -66,7 +66,7 @@ func (p *Proxy) connect(ctx context.Context, state request.Request, forceTCP, me
|
|||||||
if err == io.EOF && cached {
|
if err == io.EOF && cached {
|
||||||
return nil, errCachedClosed
|
return nil, errCachedClosed
|
||||||
}
|
}
|
||||||
return nil, err
|
return ret, err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.updateRtt(time.Since(reqTime))
|
p.updateRtt(time.Since(reqTime))
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ func TestLookupTruncated(t *testing.T) {
|
|||||||
if !resp.Truncated {
|
if !resp.Truncated {
|
||||||
t.Error("Expected to receive reply with TC bit set, but didn't")
|
t.Error("Expected to receive reply with TC bit set, but didn't")
|
||||||
}
|
}
|
||||||
|
if len(resp.Answer) != 1 {
|
||||||
|
t.Error("Expected to receive original reply, but answer is missing")
|
||||||
|
}
|
||||||
|
|
||||||
resp, err = f.Lookup(state, "example.org.", dns.TypeA)
|
resp, err = f.Lookup(state, "example.org.", dns.TypeA)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -102,6 +105,9 @@ func TestForwardTruncated(t *testing.T) {
|
|||||||
if !resp.Truncated {
|
if !resp.Truncated {
|
||||||
t.Error("Expected to receive reply with TC bit set, but didn't")
|
t.Error("Expected to receive reply with TC bit set, but didn't")
|
||||||
}
|
}
|
||||||
|
if len(resp.Answer) != 1 {
|
||||||
|
t.Error("Expected to receive original reply, but answer is missing")
|
||||||
|
}
|
||||||
|
|
||||||
resp, err = f.Forward(state)
|
resp, err = f.Forward(state)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user