diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-03-26 16:35:33 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-03-26 16:35:33 +0000 |
commit | 8df04b2342d5aa08576edff1feec40de9cff3b63 (patch) | |
tree | 2096e584e41656b04212191fe16cc21c998ab17a | |
parent | daf92ccb09a5dd4797a792a58a9ff27a0cd05dc9 (diff) | |
parent | e541cdd2b7470ca683bd2665b67092397353ca56 (diff) | |
download | okhttp-8df04b2342d5aa08576edff1feec40de9cff3b63.tar.gz |
Merge "Small updates to OkHttp-Conscrypt interaction"android-q-preview-6android-q-preview-5android-q-preview-4android-q-preview-2.5
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); } |