Skip to content

Commit 3ef9ec8

Browse files
committed
Local DoH tweaks
1 parent 3e5dbee commit 3ef9ec8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

dnscrypt-proxy/local-doh.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"crypto/tls"
45
"io/ioutil"
56
"net"
67
"net/http"
@@ -40,18 +41,20 @@ func (handler localDoHHandler) ServeHTTP(writer http.ResponseWriter, request *ht
4041
return
4142
}
4243
writer.Header().Set("Content-Type", "application/dns-message")
43-
writer.Header().Set("Content-Length", string(len(response)))
4444
writer.WriteHeader(200)
4545
writer.Write(response)
4646
}
4747

4848
func (proxy *Proxy) localDoHListener(acceptPc *net.TCPListener) {
4949
defer acceptPc.Close()
50+
noh2 := make(map[string]func(*http.Server, *tls.Conn, http.Handler))
5051
httpServer := &http.Server{
5152
ReadTimeout: proxy.timeout,
5253
WriteTimeout: proxy.timeout,
54+
TLSNextProto: noh2,
5355
Handler: localDoHHandler{proxy: proxy},
5456
}
57+
httpServer.SetKeepAlivesEnabled(true)
5558
if err := httpServer.ServeTLS(acceptPc, proxy.localDoHCertFile, proxy.localDoHCertKeyFile); err != nil {
5659
dlog.Fatal(err)
5760
}

0 commit comments

Comments
 (0)