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

Use SystemSocketFactory instead of the default factory for SSL socket factory #2592

Merged
merged 3 commits into from
Jul 16, 2020

Conversation

jacksierkstra
Copy link
Contributor

@jacksierkstra jacksierkstra commented Jul 16, 2020

Solves: #2585

@googlebot

This comment has been minimized.

@jacksierkstra
Copy link
Contributor Author

@googlebot I signed it!

@googlebot

This comment has been minimized.

Comment on lines 104 to 114
HttpClientBuilder httpClientBuilder =
HttpClientBuilder.create()
.useSystemProperties()
.setSSLSocketFactory(SSLConnectionSocketFactory.getSystemSocketFactory())
.setMaxConnTotal(200)
.setMaxConnPerRoute(20)
.setConnectionTimeToLive(-1, TimeUnit.MILLISECONDS)
.setRoutePlanner(new SystemDefaultRoutePlanner(ProxySelector.getDefault()))
.disableRedirectHandling()
.disableAutomaticRetries();
return new ApacheHttpTransport(httpClientBuilder.build());
Copy link
Member

@chanseokoh chanseokoh Jul 16, 2020

Choose a reason for hiding this comment

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

Thanks for your contribution!

As in getInsecureHttpTransport() below, can't this just be

          ApacheHttpTransport.newDefaultHttpClientBuilder()
              .setSSLSocketFactory(SSLConnectionSocketFactory.getSystemSocketFactory());

? This is exactly the reason I asked Google HTTP Client to add newDefaultHttpClientBuilder() in the past.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that would work and is cleaner. I applied your suggestion.

@chanseokoh
Copy link
Member

Cool. The code is not formatted correctly. Try running ./gradlew googleJavaFormat.

@chanseokoh chanseokoh changed the title Solving https:/GoogleContainerTools/jib/issues/2585 Use SystemSocketFactory instead of the default factory for SSL socket factory Jul 16, 2020
Copy link
Member

@chanseokoh chanseokoh 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 your contribution. We'll let you know once this becomes live.

@chanseokoh chanseokoh merged commit 2fd6edc into GoogleContainerTools:master Jul 16, 2020
louismurerwa pushed a commit that referenced this pull request Jul 17, 2020
… factory (#2592)

* Solving #2585
* Using ApacheHttpTransport.newDefaultHttpClientBuilder() instead of constructing a complete new instance.
* Applied formatting.
louismurerwa pushed a commit that referenced this pull request Jul 20, 2020
… factory (#2592)

* Solving #2585
* Using ApacheHttpTransport.newDefaultHttpClientBuilder() instead of constructing a complete new instance.
* Applied formatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants