Skip to content

Commit

Permalink
3.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentNogema committed Jun 17, 2022
1 parent ee032b6 commit 340b873
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
KnHttp Change Log
==========

Version 3.0.4 *(2022-06-17)*
----------------------------

* Updated TLS 1.3 implementation

Version 3.0.3 *(2022-06-14)*
----------------------------

* Bump androidx.appcompat:appcompat to 1.4.2
* Bump com.squareup.okio:okio to 3.1.0
* Bump com.squareup.okhttp3 to okhttp:4.10.0
* Bump com.squareup.okhttp3 to okhttp-brotli:4.10.0
* Bump com.squareup.okhttp3:okhttp to 4.10.0
* Bump com.squareup.okhttp3:okhttp-brotli to 4.10.0

Version 3.0.2 *(2022-03-20)*
----------------------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {
}
dependencies {
implementation 'com.github.Karewan:KnHttp:3.0.3'
implementation 'com.github.Karewan:KnHttp:3.0.4'
}
```

Expand Down
4 changes: 2 additions & 2 deletions knhttp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 32
versionCode 33
versionName "3.0.3"
versionCode 34
versionName "3.0.4"
consumerProguardFiles 'proguard-rules.pro'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.File;
import java.io.IOException;
import java.security.Provider;
import java.security.Security;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -237,8 +238,11 @@ public void enableLogging(Level level) {
* @param context The context
*/
public void initOkHttpClient(@Nullable Context context) {
// Use Conscrypt as the main provider
Security.insertProviderAt(Conscrypt.newProvider(), 1);
// Init Conscrypt
Provider conscrypt = Conscrypt.newProvider();

// Add as provider
Security.insertProviderAt(conscrypt, 1);

// If no settings, use default settings
if(mSettings == null) mSettings = new KnSettings.Builder().build();
Expand All @@ -262,7 +266,7 @@ public void initOkHttpClient(@Nullable Context context) {
try {
// Custom SSL socket factory to add TLS 1.3 support on all devices
X509TrustManager tm = Conscrypt.getDefaultX509TrustManager();
SSLContext sslContext = SSLContext.getInstance("TLS", "Conscrypt");
SSLContext sslContext = SSLContext.getInstance("TLS", conscrypt);
sslContext.init(null, new TrustManager[] { tm }, null);
okHttpBuilder.sslSocketFactory(new InternalSSLSocketFactory(sslContext.getSocketFactory(), mSettings.isAllowObsoleteTls()), tm);
} catch (Exception e) {
Expand All @@ -278,10 +282,6 @@ public void initOkHttpClient(@Nullable Context context) {
* @param okHttpClient The OkHttpClient
*/
public void setClient(@NonNull OkHttpClient okHttpClient) {
// Use Conscrypt as the main provider
Security.insertProviderAt(Conscrypt.newProvider(), 1);

// Set the client
mHttpClient = okHttpClient;
}
}

0 comments on commit 340b873

Please sign in to comment.