]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Report cache_peer htcp=forward-clr option (#1808)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Fri, 3 May 2024 23:49:30 +0000 (23:49 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 5 May 2024 10:37:04 +0000 (10:37 +0000)
Also simplified reporting code and addressed Coverity CID 740350:
Logically dead code (DEADCODE).

src/neighbors.cc

index 2bf088b06256ed936595330c0b00a260821e895a..63bd0fb8310a3273da555607aee073f3c36c1a43 100644 (file)
@@ -1417,25 +1417,18 @@ dump_peer_options(StoreEntry * sentry, CachePeer * p)
 #if USE_HTCP
     if (p->options.htcp) {
         os << " htcp";
-        if (p->options.htcp_oldsquid || p->options.htcp_no_clr || p->options.htcp_no_purge_clr || p->options.htcp_only_clr) {
-            bool doneopts = false;
-            if (p->options.htcp_oldsquid) {
-                os << (doneopts ? ',' : '=') << "oldsquid";
-                doneopts = true;
-            }
-            if (p->options.htcp_no_clr) {
-                os << (doneopts ? ',' : '=') << "no-clr";
-                doneopts = true;
-            }
-            if (p->options.htcp_no_purge_clr) {
-                os << (doneopts ? ',' : '=') << "no-purge-clr";
-                doneopts = true;
-            }
-            if (p->options.htcp_only_clr) {
-                os << (doneopts ? ',' : '=') << "only-clr";
-                //doneopts = true; // uncomment if more opts are added
-            }
-        }
+        std::vector<const char *, PoolingAllocator<const char *> > opts;
+        if (p->options.htcp_oldsquid)
+            opts.push_back("oldsquid");
+        if (p->options.htcp_no_clr)
+            opts.push_back("no-clr");
+        if (p->options.htcp_no_purge_clr)
+            opts.push_back("no-purge-clr");
+        if (p->options.htcp_only_clr)
+            opts.push_back("only-clr");
+        if (p->options.htcp_forward_clr)
+            opts.push_back("forward-clr");
+        os << AsList(opts).prefixedBy("=").delimitedBy(",");
     }
 #endif