Skip to content

Preserve caller options when constructing an RFC2396 parser - #254

Open
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/options-uri
Open

Preserve caller options when constructing an RFC2396 parser#254
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/options-uri

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Copy the supplied option Hash and values before internal pattern construction deletes keys and freezes pattern strings. Preserve caller ownership while retaining immutable internal patterns.

Reproduction

With options = {ESCAPED: '%[0-9a-fA-F]{2}'}, constructing URI::RFC2396_Parser.new(options) empties the caller Hash. A frozen options Hash raises FrozenError. Afterward, both work without removing entries or freezing caller strings.

Verification

  • Ruby 4.0.6 through rbenv; existing bundle exec rake test: 93 tests / 3,039 assertions / zero failures or errors, both baseline and this isolated patch.
  • 32 checks cover empty/custom escape/unreserved/hostname patterns, frozen/mutable hashes, unchanged entries and value mutability, and successful parsing.
  • Syntax and git diff --check pass. Supplemental Lint adds no findings against the 31-finding baseline.
  • No test/spec files added or modified, per this contribution's explicit no-new-tests constraint. Focused reproductions ran externally.

Compatibility and limitations

Intentional ownership correction: caller options are retained. Hash#transform_values is supported by the existing Ruby >=2.5 minimum. Custom option-string validation is unchanged. No public API removal, dependency change or Ruby minimum change.

Based on master 696df43b0be4c05d3a0dcf7db582126c915d860d. Other Ruby/OS runtimes were not executed locally. No production traffic or live mail/FTP services were used. Existing related PRs/issues were checked; this is a focused contribution, not exhaustive behavioral coverage.

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.

1 participant