Skip to content

Conversation

@samuel-williams-shopify
Copy link
Contributor

Previously, CONNECT and OPTIONS * requests returned early from parse() before extracting host and port from the Host header. This caused meta_vars to return nil for SERVER_NAME and empty string for SERVER_PORT, breaking CGI variable generation for these request types.

This change:

  • Extracts the host/port logic into a new extract_host_port method.
  • Calls setup_forwarded_info and extract_host_port for CONNECT/OPTIONS *.
  • Refactors parse_uri to use extract_host_port internally.
  • Adds tests for OPTIONS * requests with Host header.

…ests

Previously, CONNECT and OPTIONS * requests returned early from parse()
before extracting host and port from the Host header. This caused
meta_vars to return nil for SERVER_NAME and empty string for SERVER_PORT,
breaking CGI variable generation for these request types.

This change:
- Extracts the host/port logic into a new extract_host_port method
- Calls setup_forwarded_info and extract_host_port for CONNECT/OPTIONS *
- Refactors parse_uri to use extract_host_port internally
- Adds tests for OPTIONS * requests with Host header
@ioquatix ioquatix self-assigned this Dec 5, 2025
@ioquatix ioquatix requested review from hsbt and jeremyevans December 5, 2025 01:01
Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

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

Looks good. Only changes I suggest are not issues with this PR, but existing issues with the code.

@ioquatix ioquatix merged commit a72e937 into ruby:master Dec 5, 2025
21 checks passed
@ioquatix
Copy link
Member

ioquatix commented Dec 5, 2025

Thanks @jeremyevans

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