aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Vartanian <flooey@google.com>2019-03-26 10:02:54 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-03-26 10:02:54 -0700
commit72fa6035f8e7d8d58cb850e13e393222c51e7dee (patch)
tree2096e584e41656b04212191fe16cc21c998ab17a
parent38cdd2e75ecd31b6c5de29ccf9c357626456ee2f (diff)
parentb3d8a396ad1ccb4916a6669ecc58df27767b7449 (diff)
downloadokhttp-72fa6035f8e7d8d58cb850e13e393222c51e7dee.tar.gz
Merge "Small updates to OkHttp-Conscrypt interaction" am: 8df04b2342 am: aff5d4f5f6
am: b3d8a396ad Change-Id: I0a391e9ebaab494a858f1262ea4bf9ed6b7dde62
-rw-r--r--android/src/main/java/com/squareup/okhttp/internal/Platform.java11
-rw-r--r--okhttp-tests/src/test/java/com/squareup/okhttp/DelegatingSSLSocket.java4
-rw-r--r--repackaged/android/src/main/java/com/android/okhttp/internal/Platform.java11
3 files changed, 20 insertions, 6 deletions
diff --git a/android/src/main/java/com/squareup/okhttp/internal/Platform.java b/android/src/main/java/com/squareup/okhttp/internal/Platform.java
index 9edd58e..53a6eab 100644
--- a/android/src/main/java/com/squareup/okhttp/internal/Platform.java
+++ b/android/src/main/java/com/squareup/okhttp/internal/Platform.java
@@ -122,9 +122,14 @@ public class Platform {
} else {
SET_USE_SESSION_TICKETS.invokeOptionalWithoutCheckedException(sslSocket, true);
}
- // Enable SNI
- sslParams.setServerNames(
- Collections.<SNIServerName>singletonList(new SNIHostName(hostname)));
+ try {
+ // Enable SNI
+ sslParams.setServerNames(
+ Collections.<SNIServerName>singletonList(new SNIHostName(hostname)));
+ } catch (IllegalArgumentException ignored) {
+ // The hostname isn't a valid SNI value, so ignore the exception and don't set
+ // a server name, which results in no SNI extension being sent.
+ }
if (!isPlatformSocket(sslSocket)) {
SET_HOSTNAME.invokeOptionalWithoutCheckedException(sslSocket, hostname);
}
diff --git a/okhttp-tests/src/test/java/com/squareup/okhttp/DelegatingSSLSocket.java b/okhttp-tests/src/test/java/com/squareup/okhttp/DelegatingSSLSocket.java
index e13a50f..461279f 100644
--- a/okhttp-tests/src/test/java/com/squareup/okhttp/DelegatingSSLSocket.java
+++ b/okhttp-tests/src/test/java/com/squareup/okhttp/DelegatingSSLSocket.java
@@ -280,4 +280,8 @@ public abstract class DelegatingSSLSocket extends SSLSocket {
@Override public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
delegate.setPerformancePreferences(connectionTime, latency, bandwidth);
}
+
+ @Override public String getApplicationProtocol() {
+ return delegate.getApplicationProtocol();
+ }
}
diff --git a/repackaged/android/src/main/java/com/android/okhttp/internal/Platform.java b/repackaged/android/src/main/java/com/android/okhttp/internal/Platform.java
index f4505af..e0283f5 100644
--- a/repackaged/android/src/main/java/com/android/okhttp/internal/Platform.java
+++ b/repackaged/android/src/main/java/com/android/okhttp/internal/Platform.java
@@ -126,9 +126,14 @@ public class Platform {
} else {
SET_USE_SESSION_TICKETS.invokeOptionalWithoutCheckedException(sslSocket, true);
}
- // Enable SNI
- sslParams.setServerNames(
- Collections.<SNIServerName>singletonList(new SNIHostName(hostname)));
+ try {
+ // Enable SNI
+ sslParams.setServerNames(
+ Collections.<SNIServerName>singletonList(new SNIHostName(hostname)));
+ } catch (IllegalArgumentException ignored) {
+ // The hostname isn't a valid SNI value, so ignore the exception and don't set
+ // a server name, which results in no SNI extension being sent.
+ }
if (!isPlatformSocket(sslSocket)) {
SET_HOSTNAME.invokeOptionalWithoutCheckedException(sslSocket, hostname);
}