Skip to content

Use System Property Proxy Settings for Netty and Amazon CRT HTTP Clients #2771

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

Merged
merged 10 commits into from
Nov 12, 2021

Conversation

erin889
Copy link
Contributor

@erin889 erin889 commented Oct 15, 2021

Motivation and Context

Description

We modify the ProxyConfiguration so it resolves http.proxyHost, http.proxyPort, http.nonProxyHosts, http.proxyUser, http.proxyPassword from system property settings by default. If they are set explicitly like .builder().host(...), it will pick up the configuration specified, otherwise it will reads from system property.

Testing

see ProxyConfigurationTest files

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@erin889 erin889 changed the title Use system property proxy settings for netty and crt http client Use System Property Proxy Settings for Netty and Amazon CRT HTTP Clients Oct 15, 2021
Copy link
Member

@debora-ito debora-ito 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 to me, found a couple of typos.
I see you kept the implementation consistent with the Apache client ProxyConfiguration.

Will ask for an additional review from the team.

Copy link
Contributor

@Bennett-Lynch Bennett-Lynch left a comment

Choose a reason for hiding this comment

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

Hey @erin889, thanks for the PR! Apologies for the slow turnaround time.

Please see my feedback below. I will be quicker to respond to any future updates.

@erin889 erin889 force-pushed the httpclient-proxy-config branch from 066c93c to b5f71a0 Compare November 7, 2021 16:57
@erin889
Copy link
Contributor Author

erin889 commented Nov 7, 2021

@Bennett-Lynch @debora-ito Thanks for the review! I have made some updates regarding the review, feel free to take a look.

this.scheme = proxyConfiguration.scheme;
this.host = proxyConfiguration.host;
this.port = proxyConfiguration.port;
this.nonProxyHosts = new HashSet<>(proxyConfiguration.nonProxyHosts);
this.nonProxyHosts = proxyConfiguration.nonProxyHosts;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to preserve this set-copy logic. Otherwise, if a user has a ProxyConfiguration and calls toBuilder(), any modifications on the builder's set will be reflected in the original, which should be immutable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I have updated the constructor so NullPointerException won't be thrown.

@erin889 erin889 requested a review from a team as a code owner November 11, 2021 18:47
Copy link
Contributor

@Bennett-Lynch Bennett-Lynch left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @erin889!

I forgot to mention this earlier, but please run scripts/new-change to add a change log entry and to have the change attributed to your name!

@erin889 erin889 force-pushed the httpclient-proxy-config branch from fe49909 to c626239 Compare November 12, 2021 02:36
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

85.3% 85.3% Coverage
13.0% 13.0% Duplication

@debora-ito
Copy link
Member

@all-contributors please add @erin889 for code.

@allcontributors
Copy link
Contributor

@debora-ito

I've put up a pull request to add @erin889! 🎉

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.

Use http_proxy enviroment variable for ProxyConfiguration
3 participants