You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "masaori335 (via GitHub)" <gi...@apache.org> on 2026/09/14 00:37:13 UTC

[PR] header_rewrite: guard the i == 0 case in HRWSimpleTokenizer [trafficserver]

masaori335 opened a new pull request, #13672:
URL: https://github.com/apache/trafficserver/pull/13672

   A value whose first character is '{' or '<' made the tokenizer read line[-1], so whether the config loaded or was rejected with an opaque "basic_string" error depended on the adjacent byte. Matches the guard parse_line already uses for the same idiom.


-- 
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-unsubscribe@trafficserver.apache.org

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


Re: [PR] header_rewrite: guard the i == 0 case in HRWSimpleTokenizer [trafficserver]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #13672:
URL: https://github.com/apache/trafficserver/pull/13672#discussion_r4001464576


##########
plugins/header_rewrite/header_rewrite_test.cc:
##########
@@ -557,6 +557,15 @@ test_tokenizer()
     END_TEST();
   }
 
+  {
+    SimpleTokenizerTest p("{a}%{PATH}");
+    CHECK_EQ(p.get_tokens().size(), 2UL);
+    CHECK_EQ(p.get_tokens()[0], "{a}");
+    CHECK_EQ(p.get_tokens()[1], "%{PATH}");
+
+    END_TEST();
+  }

Review Comment:
   This regression test covers only a leading `{`, but the fixed condition also protects a leading `<`; that input previously evaluated `line[-1]` through the same path. Add a `<`-leading case as well so the second trigger cannot regress untested.



-- 
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-unsubscribe@trafficserver.apache.org

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


Re: [PR] header_rewrite: guard the i == 0 case in HRWSimpleTokenizer [trafficserver]

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on code in PR #13672:
URL: https://github.com/apache/trafficserver/pull/13672#discussion_r4001714167


##########
plugins/header_rewrite/header_rewrite_test.cc:
##########
@@ -557,6 +557,15 @@ test_tokenizer()
     END_TEST();
   }
 
+  {
+    SimpleTokenizerTest p("{a}%{PATH}");
+    CHECK_EQ(p.get_tokens().size(), 2UL);
+    CHECK_EQ(p.get_tokens()[0], "{a}");
+    CHECK_EQ(p.get_tokens()[1], "%{PATH}");
+
+    END_TEST();
+  }

Review Comment:
   Done byt 6207478



##########
plugins/header_rewrite/header_rewrite_test.cc:
##########
@@ -557,6 +557,15 @@ test_tokenizer()
     END_TEST();
   }
 
+  {
+    SimpleTokenizerTest p("{a}%{PATH}");
+    CHECK_EQ(p.get_tokens().size(), 2UL);
+    CHECK_EQ(p.get_tokens()[0], "{a}");
+    CHECK_EQ(p.get_tokens()[1], "%{PATH}");
+
+    END_TEST();
+  }

Review Comment:
   Done by 6207478



-- 
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-unsubscribe@trafficserver.apache.org

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


Re: [PR] header_rewrite: guard the i == 0 case in HRWSimpleTokenizer [trafficserver]

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on PR #13672:
URL: https://github.com/apache/trafficserver/pull/13672#issuecomment-5689311867

   It's `Parser::parse_line` which makes sure the `line[i-1]` runs only if `i >= 1`.


-- 
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-unsubscribe@trafficserver.apache.org

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


Re: [PR] header_rewrite: guard the i == 0 case in HRWSimpleTokenizer [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #13672:
URL: https://github.com/apache/trafficserver/pull/13672#issuecomment-5764324394

   Cherry-picked to the 10.2.x branch as cb46c4e31826f6a868f863a268a3e12256d029ce for the 10.2.1 release.


-- 
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-unsubscribe@trafficserver.apache.org

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


Re: [PR] header_rewrite: guard the i == 0 case in HRWSimpleTokenizer [trafficserver]

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 merged PR #13672:
URL: https://github.com/apache/trafficserver/pull/13672


-- 
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-unsubscribe@trafficserver.apache.org

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