From 3ef9ec8732d53f305d8465b7a2ec2d9fb0f3f8f8 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 28 Nov 2019 23:08:23 +0100 Subject: [PATCH] Local DoH tweaks --- dnscrypt-proxy/local-doh.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dnscrypt-proxy/local-doh.go b/dnscrypt-proxy/local-doh.go index 2e337ed7..a4e041e2 100644 --- a/dnscrypt-proxy/local-doh.go +++ b/dnscrypt-proxy/local-doh.go @@ -1,6 +1,7 @@ package main import ( + "crypto/tls" "io/ioutil" "net" "net/http" @@ -40,18 +41,20 @@ func (handler localDoHHandler) ServeHTTP(writer http.ResponseWriter, request *ht return } writer.Header().Set("Content-Type", "application/dns-message") - writer.Header().Set("Content-Length", string(len(response))) writer.WriteHeader(200) writer.Write(response) } func (proxy *Proxy) localDoHListener(acceptPc *net.TCPListener) { defer acceptPc.Close() + noh2 := make(map[string]func(*http.Server, *tls.Conn, http.Handler)) httpServer := &http.Server{ ReadTimeout: proxy.timeout, WriteTimeout: proxy.timeout, + TLSNextProto: noh2, Handler: localDoHHandler{proxy: proxy}, } + httpServer.SetKeepAlivesEnabled(true) if err := httpServer.ServeTLS(acceptPc, proxy.localDoHCertFile, proxy.localDoHCertKeyFile); err != nil { dlog.Fatal(err) }