]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #2100: Respect DNS ttl=0
authorhno <>
Sat, 13 Oct 2007 06:02:28 +0000 (06:02 +0000)
committerhno <>
Sat, 13 Oct 2007 06:02:28 +0000 (06:02 +0000)
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).

src/fqdncache.cc
src/ipcache.cc

index c1e57d517ce5e74d546eb80744771c6589ac4b40..adcf02eb4e6f9cc5edbe7511519822b905d34673 100644 (file)
@@ -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)
index 7ff75350203e5b6cbeaedd9251122110616e966a..05c4f9d856a2e175e5539837b57341d3cc2e9e28 100644 (file)
@@ -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)