[Schmitzm-commits] r2340 - trunk/schmitzm-core/src/main/java/de/schmitzm/io
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Sun Jun 9 22:28:17 CEST 2013
Author: mojays
Date: 2013-06-09 22:28:17 +0200 (Sun, 09 Jun 2013)
New Revision: 2340
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
Log:
- IOUtil.determineUrlFileSize(.): ignore certificates (always) for https URL
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java 2013-06-09 20:08:08 UTC (rev 2339)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java 2013-06-09 20:28:17 UTC (rev 2340)
@@ -1093,6 +1093,20 @@
// JUST HANDLE USING PROXY!!
// Note: Problem with read timeout exception remains! :-(
URLConnection connection = openConnection(url, authUser, authPassword, proxy, connTimeout, readTimeout);
+ // For SSL connections ignore all certificates
+ if ( connection instanceof HttpsURLConnection )
+ try {
+ // Install the all-trusting trust manager
+ final SSLContext sslContext = SSLContext.getInstance( "SSL" );
+ sslContext.init( null, TRUST_ALL_CERTS_TRUSTMANAGER, new java.security.SecureRandom() );
+ // Create an ssl socket factory with our all-trusting manager
+ final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
+ // Reset SSL socket factory to ignore SSL certificates
+ ((HttpsURLConnection)connection).setSSLSocketFactory(sslSocketFactory);
+ LOGGER.warn("SSL connecion established ignoring any certificate!");
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
fileSize = connection.getContentLength();
break;
} catch ( IOException err ) {
More information about the Schmitzm-commits
mailing list