This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

StrictHostnameVerifier replacement to fix S3 SSL issues

By: dig090 on Oct 5th, 2012  |  syntax: Java  |  size: 0.72 KB  |  views: 238  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data