Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,6 @@ class ConnectPlan internal constructor(
sslSocket: SSLSocket,
sslException: SSLException,
): ConnectPlan? {
if (!retryOnConnectionFailure) return null

// If this was an ECH retry, don't retry again.
if (echRetryPlan != null) return null

Expand Down Expand Up @@ -533,6 +531,9 @@ class ConnectPlan internal constructor(
)
}

// If recovery is configured off, don't retry.
if (!retryOnConnectionFailure) return null

// If the exception is not recoverable, don't retry.
if (!attemptAnotherConnectionSpec(sslException)) return null

Expand Down
12 changes: 11 additions & 1 deletion okhttp/src/jvmTest/kotlin/okhttp3/EchOnFakeNetworkTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,25 @@ class EchOnFakeNetworkTest {
.isEqualTo("handshake hostname=private.ech.example.com echConfigList=null")
}

/**
* This runs with [OkHttpClient.retryOnConnectionFailure] enabled and disabled. (We always want
* ECH retries, regardless of what this setting is.)
*/
@Test
fun `server updates ech config for retry`() {
fun `server updates ech config for retry`(retryOnConnectionFailure: Boolean) {
val updatedEchConfigList = "new key to encrypt 'private.ech.example.com'".encodeUtf8()
platform.handshaker =
handshakerWithUpdatedEchConfigList(
updatedEchConfigList = updatedEchConfigList,
attemptLimit = 2,
)

client =
client
.newBuilder()
.retryOnConnectionFailure(retryOnConnectionFailure)
.build()

executeHttpExchange()

assertThat(events.take())
Expand Down
Loading