Skip to content

Commit

Permalink
patch: don't modify original res
Browse files Browse the repository at this point in the history
  • Loading branch information
developStorm committed Nov 16, 2024
1 parent 148eb28 commit 7926796
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/zdns/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,13 @@ func (s *Cache) SafeAddCachedAuthority(res *SingleQueryResult, ns *NameServer, d
}
}

res.Authorities = otherRRs
res = &SingleQueryResult{
Answers: otherRRs,
Protocol: res.Protocol,
Resolver: res.Resolver,
Flags: res.Flags,
TLSServerHandshake: res.TLSServerHandshake,
}
cachedRes := s.buildCachedResult(res, depth, layer)
if len(cachedRes.Answers) == 0 && len(cachedRes.Authorities) == 0 && len(cachedRes.Additionals) == 0 {
s.VerboseLog(depth+1, "SafeAddCachedAnswer: no cacheable records found, aborting")
Expand Down

0 comments on commit 7926796

Please sign in to comment.