Skip to content

Conversation

@cmcfarlen
Copy link
Contributor

This cherry-picks #12573 in order to fix #12769

  • Update header_rewrite to use Regex

  • PR review

  • cast to int

  • also move dbg for failed regex compile.

(cherry picked from commit a15669b)

* Update header_rewrite to use Regex

* PR review

* cast to int

* also move dbg for failed regex compile.

(cherry picked from commit a15669b)
@cmcfarlen cmcfarlen added this to the 10.1.1 milestone Jan 7, 2026
@cmcfarlen cmcfarlen self-assigned this Jan 7, 2026
@cmcfarlen cmcfarlen added Bug Backport Marked for backport for an LTS patch release labels Jan 7, 2026
@bryancall bryancall requested a review from Copilot January 12, 2026 22:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the header_rewrite plugin by replacing direct PCRE API usage with the new tsutil Regex wrapper class. This is a cherry-pick from commit #12573 to fix issue #12769.

Changes:

  • Replaced PCRE-specific data structures (ovector, pcre pointers) with the new Regex and RegexMatches classes
  • Updated regex compilation and matching to use the Regex API
  • Removed direct PCRE library dependency from CMakeLists.txt

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
plugins/header_rewrite/resources.h Replaced ovector-related members with RegexMatches object
plugins/header_rewrite/resources.cc Removed ovector initialization code
plugins/header_rewrite/regex_helper.h Updated to use Regex class instead of pcre pointers
plugins/header_rewrite/regex_helper.cc Implemented regex operations using new Regex API
plugins/header_rewrite/matcher.h Updated regex matching to use RegexMatches
plugins/header_rewrite/conditions.cc Simplified capture group access using RegexMatches indexing
plugins/header_rewrite/CMakeLists.txt Removed PCRE library dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1721 to +1722
if (res.matches.size() > _ix) {
s.append(res.matches[_ix]);
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing int32_t (size()) with int (_ix) can lead to signed comparison warnings. Since _ix is validated to be >= 0 in set_qualifier, consider casting _ix to size_t or int32_t for the comparison to avoid potential warnings.

Suggested change
if (res.matches.size() > _ix) {
s.append(res.matches[_ix]);
if (res.matches.size() > static_cast<size_t>(_ix)) {
s.append(res.matches[static_cast<size_t>(_ix)]);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport Marked for backport for an LTS patch release Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants