Skip to content

Parse capture groups in if-blocks. Fixes #50.#51

Closed
MegaManSec wants to merge 8 commits intodvershinin:masterfrom
MegaManSec:if-variables
Closed

Parse capture groups in if-blocks. Fixes #50.#51
MegaManSec wants to merge 8 commits intodvershinin:masterfrom
MegaManSec:if-variables

Conversation

@MegaManSec
Copy link

No description provided.

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

@dvershinin dvershinin requested a review from Copilot September 30, 2025 14:02
Copy link

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 adds support for parsing capture groups in nginx if-blocks by implementing variable extraction from regex patterns. This enhancement fixes issue #50 by enabling proper handling of regex capture groups that can be referenced within if-blocks.

  • Modifies IfBlock class to provide variables from regex capture groups
  • Adds regex detection and variable extraction functionality
  • Updates test expectations to reflect new variable provision behavior

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
gixy/directives/block.py Implements variable extraction logic for if-blocks with regex patterns
tests/directives/test_block.py Updates test assertion to expect variable provision in if-blocks
tests/plugins/simply/http_splitting/if_block.conf Adds test case for if-block with capture group using $uri
tests/plugins/simply/http_splitting/if_block_fp.conf Adds test case for if-block with capture group using $request_uri

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Joshua Rogers and others added 3 commits September 30, 2025 16:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MegaManSec
Copy link
Author

fixed the merge conflict

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 6, 2025

@dvershinin
Copy link
Owner

Thank you for this contribution! The feature has been rebased and adapted for the current crossplane-based parser in #91.

Closing this PR in favor of the rebased version.

@dvershinin dvershinin closed this Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants