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

Fix custom SSLSocketFactory not being set because of an unsafe lazy-initialization in JDK #4566

Merged
merged 2 commits into from
Dec 17, 2020

Commits on Sep 15, 2020

  1. Avoid unsafe lazy-initialization for SSL sockets

    This prevents calling HttpsURLConnection.getDefaultSSLSocketFactory() in
    an unsafe manner due to the poorly implemented lazy-initialization on
    the JDK.
    
    When multiple threads call that method concurrently (calling
    secureConnection()) the SSLSocketFactory is instantiated two times,
    making one thread fail the check and overriding the custom socket
    factory with the default one.
    
    Signed-off-by: Adrian Haasler García <[email protected]>
    ahaasler committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    7dc7d89 View commit details
    Browse the repository at this point in the history
  2. Add test for concurrent custom SSLSocketFactory

    Test made by Kevin Conaway @kevinconaway
    
    Also-by: Kevin Conaway <[email protected]>
    Signed-off-by: Adrian Haasler García <[email protected]>
    ahaasler committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    6a8e80e View commit details
    Browse the repository at this point in the history