From: hno <> Date: Sat, 13 Oct 2007 06:02:28 +0000 (+0000) Subject: Bug #2100: Respect DNS ttl=0 X-Git-Tag: SQUID_3_0_STABLE1~78 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e8c410779616eb7a689eba69ee5ffbf5a4ac7d5;p=thirdparty%2Fsquid.git Bug #2100: Respect DNS ttl=0 Some DNS servers responds with a ttl=0 asking their results to not be cached for long, but due to historical reasons from before when Squid had an internal DNS client such DNS responses got cached for the positive DNS ttl (default 1 hour). Witch this change such DNS responses gets cached for the minimum allowed TTL (negative_dns_ttl, default 1 minute). --- diff --git a/src/fqdncache.cc b/src/fqdncache.cc index c1e57d517c..adcf02eb4e 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.174 2007/09/17 09:05:52 hno Exp $ + * $Id: fqdncache.cc,v 1.175 2007/10/13 00:02:28 hno Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -396,7 +396,7 @@ fqdncacheParse(fqdncache_entry *f, rfc1035_rr * answers, int nr, const char *err return 0; } - if (ttl == 0 || ttl > Config.positiveDnsTtl) + if (ttl > Config.positiveDnsTtl) ttl = Config.positiveDnsTtl; if (ttl < Config.negativeDnsTtl) diff --git a/src/ipcache.cc b/src/ipcache.cc index 7ff7535020..05c4f9d856 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.263 2007/09/17 09:05:52 hno Exp $ + * $Id: ipcache.cc,v 1.264 2007/10/13 00:02:28 hno Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -455,7 +455,7 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m else i->addrs.count = 255; - if (ttl == 0 || ttl > Config.positiveDnsTtl) + if (ttl > Config.positiveDnsTtl) ttl = Config.positiveDnsTtl; if (ttl < Config.negativeDnsTtl)