Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPCLIENT-2293 Enforce Port Specification for CONNECT Request #482

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

arturobernalg
Copy link
Member

This PR introduces a change to the ProxyClient class to ensure that a port is always specified when making a CONNECT request, in line with the requirements set out in RFC 9110.

HttpHost host = target;
if (host.getPort() <= 0) {
host = new HttpHost(host.getSchemeName(), host.getHostName(), 80);
if (target.getPort() <= 0) {
Copy link
Member

Choose a reason for hiding this comment

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

@arturobernalg It would be nicer (and more consistent) to use Args#check here but not a deal breaker.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ok2c
True. changed.

…r RFC 9110

 - This adheres to RFC 9110, which states: "There is no default port; a client MUST send the port number even if the CONNECT request is based on a URI reference that contains an authority component with an elided port.
@arturobernalg arturobernalg merged commit 3cac2e6 into apache:5.4.x Sep 15, 2023
7 checks passed
ok2c pushed a commit that referenced this pull request Dec 13, 2023
…r RFC 9110 (#482)

- This adheres to RFC 9110, which states: "There is no default port; a client MUST send the port number even if the CONNECT request is based on a URI reference that contains an authority component with an elided port.
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.

2 participants