aboutsummaryrefslogtreecommitdiff
path: root/request/request.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-10-23 17:55:40 +0100
committerGravatar John Belamaric <jbelamaric@google.com> 2018-10-23 09:55:40 -0700
commit898b1ef31691fac4bc45ad507f6d5762555f4dea (patch)
tree688a8c6b1a994c09f6b50ed3c6ef9ad68a5321fb /request/request.go
parent96529b2c501b47a71a0f6eae5a04ebe86ba1ab1d (diff)
downloadcoredns-898b1ef31691fac4bc45ad507f6d5762555f4dea.tar.gz
coredns-898b1ef31691fac4bc45ad507f6d5762555f4dea.tar.zst
coredns-898b1ef31691fac4bc45ad507f6d5762555f4dea.zip
server: actually scrub response (#2225)
* server: actually scrub response Did all the worked, hooked it up wrongly :( This also needs test, but those are hard(er) because we only receive packets after they have been decoded; i.e. we never see the wirefmt. Signed-off-by: Miek Gieben <miek@miek.nl> * Add tests Add a test for checking is compression pointers are set in the packet. This also adds an undocumented 'large' feature to the erratic plugin to send large responses that should be compressed. Commenting the Scrub out in server results in: === RUN TestCompressScrub --- FAIL: TestCompressScrub (0.00s) compression_scrub_test.go:41: Expected returned packet to be < 512, got 839 FAIL exit status 1 FAIL github.com/coredns/coredns/test 0.036s Actually checking the size might be easier, but lets be thorough here and check the pointers them selves. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * plugin erratic: fix e.large always put an rr in the reply, fix e.large in erractic and add test to check for it. Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'request/request.go')
-rw-r--r--request/request.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/request/request.go b/request/request.go
index c4e4eea3c..f560612c8 100644
--- a/request/request.go
+++ b/request/request.go
@@ -226,11 +226,7 @@ func (r *Request) SizeAndDo(m *dns.Msg) bool {
return true
}
-// Scrub is a noop function, added for backwards compatibility reasons. The original Scrub is now called
-// automatically by the server on writing the reply. See ScrubWriter.
-func (r *Request) Scrub(reply *dns.Msg) (*dns.Msg, int) { return reply, 0 }
-
-// scrub scrubs the reply message so that it will fit the client's buffer. It will first
+// Scrub scrubs the reply message so that it will fit the client's buffer. It will first
// check if the reply fits without compression and then *with* compression.
// Scrub will then use binary search to find a save cut off point in the additional section.
// If even *without* the additional section the reply still doesn't fit we
@@ -238,7 +234,7 @@ func (r *Request) Scrub(reply *dns.Msg) (*dns.Msg, int) { return reply, 0 }
// we set the TC bit on the reply; indicating the client should retry over TCP.
// Note, the TC bit will be set regardless of protocol, even TCP message will
// get the bit, the client should then retry with pigeons.
-func (r *Request) scrub(reply *dns.Msg) *dns.Msg {
+func (r *Request) Scrub(reply *dns.Msg) *dns.Msg {
size := r.Size()
reply.Compress = false