Skip to content

Conversation

@arut
Copy link
Contributor

@arut arut commented Oct 21, 2025

The PR adds the$request_port variable for HTTP request, followed by the infrastructure for HTTP CONNECT method.

@arut arut requested a review from pluknet October 21, 2025 17:36
@arut arut changed the title HTTP connect infrastructure HTTP CONNECT infrastructure Oct 21, 2025
@Maryna-f5 Maryna-f5 added this to the nginx-1.29.3 milestone Oct 21, 2025
if (ngx_str7_cmp(m, 'C', 'O', 'N', 'N', 'E', 'C', 'T', ' '))
{
r->method = NGX_HTTP_CONNECT;
state = sw_spaces_before_host;
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to add break statement there, see also 0a6efee

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If only for symmetry in case we add one for the OPTIONS as well. Otherwise it does not seem to make sense.

@pluknet
Copy link
Contributor

pluknet commented Oct 22, 2025

I think we may need to resurrect $is_request_port for constructs with optional port (such as other than in CONNECT), to make the following possible:

proxy_set_header Host $host$is_request_port$request_port;

(see also PR 236 as such an example)

arut added 2 commits October 22, 2025 21:22
The $request_port variable contains the port passed by the client in the
request line (for HTTP/1.x) or ":authority" pseudo-header (for HTTP/2 and
HTTP/3).  If the request line contains no host, or ":authority" is missing,
then $request_port is taken from the "Host" header, similar to the $host
variable.

The $is_request_port variable contains ":" if $request_port is non-empty,
and is empty otherwise.
The change allows modules to use the CONNECT method with HTTP/1.1 requests.
To do so, they need to set the "allow_connect" flag in the core server
configuration.
@arut arut merged commit 42ca3a4 into nginx:master Oct 23, 2025
2 checks passed
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