--------------------- PatchSet 11725 Date: 2007/10/13 00:01:38 Author: hno Branch: HEAD Tag: (none) Log: 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). Members: src/fqdncache.c:1.157->1.158 src/ipcache.c:1.247->1.248 Index: squid/src/fqdncache.c =================================================================== RCS file: /cvsroot/squid/squid/src/fqdncache.c,v retrieving revision 1.157 retrieving revision 1.158 diff -u -r1.157 -r1.158 --- squid/src/fqdncache.c 17 Sep 2007 09:38:30 -0000 1.157 +++ squid/src/fqdncache.c 13 Oct 2007 00:01:38 -0000 1.158 @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.c,v 1.157 2007/09/17 09:38:30 hno Exp $ + * $Id: fqdncache.c,v 1.158 2007/10/13 00:01:38 hno Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -316,7 +316,7 @@ f->error_message = xstrdup("No PTR record"); return f; } - if (ttl == 0 || ttl > Config.positiveDnsTtl) + if (ttl > Config.positiveDnsTtl) ttl = Config.positiveDnsTtl; if (ttl < Config.negativeDnsTtl) ttl = Config.negativeDnsTtl; Index: squid/src/ipcache.c =================================================================== RCS file: /cvsroot/squid/squid/src/ipcache.c,v retrieving revision 1.247 retrieving revision 1.248 diff -u -r1.247 -r1.248 --- squid/src/ipcache.c 17 Sep 2007 09:38:30 -0000 1.247 +++ squid/src/ipcache.c 13 Oct 2007 00:01:38 -0000 1.248 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.c,v 1.247 2007/09/17 09:38:30 hno Exp $ + * $Id: ipcache.c,v 1.248 2007/10/13 00:01:38 hno Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -369,7 +369,7 @@ i->addrs.count = (unsigned char) na; else i->addrs.count = 255; - if (ttl == 0 || ttl > Config.positiveDnsTtl) + if (ttl > Config.positiveDnsTtl) ttl = Config.positiveDnsTtl; if (ttl < Config.negativeDnsTtl) ttl = Config.negativeDnsTtl;