Advertisement
dig090

StrictHostnameVerifier replacement to fix S3 SSL issues

Oct 5th, 2012
1,144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package org.apache.http.conn.ssl;
  2.  
  3. import javax.net.ssl.SSLException;
  4.  
  5. import org.apache.http.annotation.Immutable;
  6.  
  7. /**
  8.  * Override the StrictHostnameVerifier to hack around problems with the S3 SSL changes in 9/2012.
  9.  *
  10.  * WARNING: this will disable strict checking on all Apache HttpClient connections.
  11.  */
  12. @Immutable
  13. public class StrictHostnameVerifier extends AbstractVerifier {
  14.  
  15.     private X509HostnameVerifier deligater = new AllowAllHostnameVerifier();
  16.  
  17.     @Override
  18.     public final void verify(final String host, final String[] cns, final String[] subjectAlts) throws SSLException {
  19.         deligater.verify(host, cns, subjectAlts);
  20.     }
  21.  
  22.     @Override
  23.     public final String toString() {
  24.         return deligater.toString();
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement