Skip to content

Commit

Permalink
4.4.1.2 version, with patched SSLConnectionSocketFactory.java to prov…
Browse files Browse the repository at this point in the history
…ide SNI support on Android
  • Loading branch information
smarek committed Apr 2, 2016
1 parent 7bcf666 commit 94df6a1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 88 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ ${SED_CMD} "s/sedpackage/cz\.msebera\.httpclient\.android/g" src/main/AndroidMan
cd ${ANDROIDPROJECTPATH}
patch ${PACKAGEDIR}/conn/ssl/DefaultHostnameVerifier.java ../patches/DefaultHostnameVerifier.java.patch.4.4.1
patch ${PACKAGEDIR}/conn/ssl/AbstractVerifier.java ../patches/AbstractVerifier.java.patch.4.4.1
patch ${PACKAGEDIR}/conn/ssl/SSLConnectionSocketFactory.java ../patches/SSLConnectionSocketFactory.java.patch.4.4.1
cp ../patches/DistinguishedNameParser.java ${PACKAGEDIR}/conn/ssl/

echo ">> Gradle build proceed"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=4.4.1.1
VERSION_CODE=4411
VERSION_NAME=4.4.1.2
VERSION_CODE=4412
GROUP=cz.msebera.android

POM_ARTIFACT_ID=httpclient
Expand Down
85 changes: 0 additions & 85 deletions patches/AbstractVerifier.java.patch.4.3.5

This file was deleted.

27 changes: 27 additions & 0 deletions patches/SSLConnectionSocketFactory.java.patch.4.4.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
29a30,35
> import android.os.Build;
> import android.util.Log;
> import android.annotation.TargetApi;
> import java.lang.reflect.InvocationTargetException;
> import java.lang.reflect.Method;
>
138a145
> public static final String TAG = "SSLConnSockFact";
393a401,417
>
> // Android specific code to enable SNI
> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
> if (Log.isLoggable(TAG, Log.DEBUG)) {
> Log.d(TAG, "Enabling SNI for " + target);
> }
> try {
> Method method = sslsock.getClass().getMethod("setHostname", String.class);
> method.invoke(sslsock, target);
> } catch (Exception ex) {
> if (Log.isLoggable(TAG, Log.DEBUG)) {
> Log.d(TAG, "SNI configuration failed", ex);
> }
> }
> }
> // End of Android specific code
>

0 comments on commit 94df6a1

Please sign in to comment.