You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Andrea Turli <no...@github.com> on 2015/05/06 10:29:12 UTC

[jclouds-labs] [JCLOUDS-898] better management of HTTP connections (#172)

You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs/pull/172

-- Commit Summary --

  * better management of HTTP connections

-- File Changes --

    M docker/src/main/java/org/jclouds/docker/config/DockerOkHttpClientSupplier.java (6)
    M docker/src/main/java/org/jclouds/docker/suppliers/SSLContextWithKeysSupplier.java (30)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/172.patch
https://github.com/jclouds/jclouds-labs/pull/172.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/172

Re: [jclouds-labs] [JCLOUDS-898] better management of HTTP connections (#172)

Posted by Ignasi Barrera <no...@github.com>.
Closed #172.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/172#event-382358016

Re: [jclouds-labs] [JCLOUDS-898] better management of HTTP connections (#172)

Posted by Ignasi Barrera <no...@github.com>.
>        }
> +      return null; // identity and/or credentials are not files, can't setup sslContext

Don't return null. Suppliers should not return null. Instead, move the is file checks to the calling class, and only call the supplier if needed.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/172/files#r29742488

Re: [jclouds-labs] [JCLOUDS-898] better management of HTTP connections (#172)

Posted by Ignasi Barrera <no...@github.com>.
> -         throw propagate(e);
> -      } catch (KeyManagementException e) {
> -         throw propagate(e);
> -      } catch (CertificateException e) {
> -         throw propagate(e);
> -      } catch (IOException e) {
> -         throw propagate(e);
> +      if (new File(currentCreds.identity).isFile() && new File(currentCreds.credential).isFile()) {
> +         try {
> +            SSLContext sslContext = SSLContext.getInstance("TLS");
> +            X509Certificate certificate = getCertificate(loadFile(currentCreds.identity));
> +            PrivateKey privateKey = getKey(loadFile(currentCreds.credential));
> +            sslContext.init(new KeyManager[]{new InMemoryKeyManager(certificate, privateKey)}, trustManager, new SecureRandom());
> +            return sslContext;
> +         } catch (GeneralSecurityException e) {
> +            throw new AssertionError(); // The system has no TLS. Just give up.

propagate a proper exception here.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/172/files#r29742463

Re: [jclouds-labs] [JCLOUDS-898] better management of HTTP connections (#172)

Posted by Ignasi Barrera <no...@github.com>.
Up to date PR: https://github.com/jclouds/jclouds-labs/pull/198

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/172#issuecomment-131030831