Local-DoH: pad responses

This commit is contained in:
Frank Denis 2019-11-29 21:34:16 +01:00
parent f9019f46a4
commit 21c63a5608
1 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"io/ioutil"
"net"
"net/http"
"strings"
"time"
"github.com/jedisct1/dlog"
@ -46,7 +47,9 @@ func (handler localDoHHandler) ServeHTTP(writer http.ResponseWriter, request *ht
writer.WriteHeader(500)
return
}
padLen := 127 - (len(response)+127)&127
writer.Header().Set("Content-Type", dataType)
writer.Header().Set("X-Pad", strings.Repeat("X", padLen))
writer.WriteHeader(200)
writer.Write(response)
}