equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
527 try { |
527 try { |
528 serverOutput = new PrintStream( |
528 serverOutput = new PrintStream( |
529 new BufferedOutputStream(serverSocket.getOutputStream()), |
529 new BufferedOutputStream(serverSocket.getOutputStream()), |
530 false, encoding); |
530 false, encoding); |
531 } catch (UnsupportedEncodingException e) { |
531 } catch (UnsupportedEncodingException e) { |
532 throw new InternalError(encoding+" encoding not found", e); |
532 throw new InternalError(encoding+" encoding not found"); |
533 } |
533 } |
534 |
534 |
535 // check URL spoofing if it has not been checked under handshaking |
535 // check URL spoofing if it has not been checked under handshaking |
536 if (needToCheckSpoofing) { |
536 if (needToCheckSpoofing) { |
537 checkURLSpoofing(hv); |
537 checkURLSpoofing(hv); |
621 /* |
621 /* |
622 * Close an idle connection to this URL (if it exists in the cache). |
622 * Close an idle connection to this URL (if it exists in the cache). |
623 */ |
623 */ |
624 @Override |
624 @Override |
625 public void closeIdleConnection() { |
625 public void closeIdleConnection() { |
626 HttpClient http = (HttpClient) kac.get(url, sslSocketFactory); |
626 HttpClient http = kac.get(url, sslSocketFactory); |
627 if (http != null) { |
627 if (http != null) { |
628 http.closeServer(); |
628 http.closeServer(); |
629 } |
629 } |
630 } |
630 } |
631 |
631 |
679 } catch (AbstractMethodError e) { |
679 } catch (AbstractMethodError e) { |
680 // if the provider does not support it, fallback to peer certs. |
680 // if the provider does not support it, fallback to peer certs. |
681 // return the X500Principal of the end-entity cert. |
681 // return the X500Principal of the end-entity cert. |
682 java.security.cert.Certificate[] certs = |
682 java.security.cert.Certificate[] certs = |
683 session.getPeerCertificates(); |
683 session.getPeerCertificates(); |
684 principal = (X500Principal) |
684 principal = ((X509Certificate)certs[0]).getSubjectX500Principal(); |
685 ((X509Certificate)certs[0]).getSubjectX500Principal(); |
|
686 } |
685 } |
687 return principal; |
686 return principal; |
688 } |
687 } |
689 |
688 |
690 /** |
689 /** |
701 // if the provider does not support it, fallback to local certs. |
700 // if the provider does not support it, fallback to local certs. |
702 // return the X500Principal of the end-entity cert. |
701 // return the X500Principal of the end-entity cert. |
703 java.security.cert.Certificate[] certs = |
702 java.security.cert.Certificate[] certs = |
704 session.getLocalCertificates(); |
703 session.getLocalCertificates(); |
705 if (certs != null) { |
704 if (certs != null) { |
706 principal = (X500Principal) |
705 principal = ((X509Certificate)certs[0]).getSubjectX500Principal(); |
707 ((X509Certificate)certs[0]).getSubjectX500Principal(); |
|
708 } |
706 } |
709 } |
707 } |
710 return principal; |
708 return principal; |
711 } |
709 } |
712 |
710 |