mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-04 10:24:40 +01:00
Repair stale respones for DoH
This commit is contained in:
parent
e5608e08cf
commit
d82021b545
1 changed files with 7 additions and 5 deletions
|
@ -573,6 +573,7 @@ func (proxy *Proxy) clientsCountDec() {
|
|||
}
|
||||
|
||||
func (proxy *Proxy) processIncomingQuery(clientProto string, serverProto string, query []byte, clientAddr *net.Addr, clientPc net.Conn, start time.Time, onlyCached bool) (response []byte) {
|
||||
response = nil
|
||||
if len(query) < MinDNSPacketSize {
|
||||
return
|
||||
}
|
||||
|
@ -668,11 +669,12 @@ func (proxy *Proxy) processIncomingQuery(clientProto string, serverProto string,
|
|||
serverInfo.noticeBegin(proxy)
|
||||
serverResponse, _, tls, _, err := proxy.xTransport.DoHQuery(serverInfo.useGet, serverInfo.URL, query, proxy.timeout)
|
||||
SetTransactionID(query, tid)
|
||||
if err == nil || tls == nil || !tls.HandshakeComplete {
|
||||
response = nil
|
||||
} else if stale, ok := pluginsState.sessionData["stale"]; ok {
|
||||
dlog.Debug("Serving stale response")
|
||||
response, err = (stale.(*dns.Msg)).Pack()
|
||||
|
||||
if err != nil || tls == nil || !tls.HandshakeComplete {
|
||||
if stale, ok := pluginsState.sessionData["stale"]; ok {
|
||||
dlog.Debug("Serving stale response")
|
||||
response, err = (stale.(*dns.Msg)).Pack()
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
pluginsState.returnCode = PluginsReturnCodeNetworkError
|
||||
|
|
Loading…
Add table
Reference in a new issue