bneradt commented on code in PR #12304:
URL: https://github.com/apache/trafficserver/pull/12304#discussion_r2153221865


##########
plugins/header_rewrite/header_rewrite.cc:
##########
@@ -206,15 +202,43 @@ RulesConfig::parse_config(const std::string &fname, 
TSHttpHookID default_hook, c
       continue;
     }
 
-    // If we are at the beginning of a new condition, save away the previous 
rule (but only if it has operators).
-    if (p.is_cond() && add_rule(rule.get())) {
-      rule.release();
+    TSHttpHookID hook    = default_hook;
+    bool         is_hook = p.cond_is_hook(hook);
+
+    // Deal with the elsif / else special keywords, these are neither 
conditions nor operators.

Review Comment:
   `elsif` -> `elif`



##########
plugins/header_rewrite/header_rewrite.cc:
##########
@@ -304,8 +325,8 @@ RulesConfig::parse_config(const std::string &fname, 
TSHttpHookID default_hook, c
   }
 
   // Add the last rule (possibly the only rule)
-  if (add_rule(rule.get())) {
-    rule.release();
+  if (rule && rule->has_operator()) {
+    add_rule(std::move(rule)); // Transfer ownership

Review Comment:
   No need for `// Transfer ownership` comment, that's clear from `std::move` 
on a `unique_ptr`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to