Visitar URL original
retryOnConnectionFailure doesn't impact ECH retries (#9681) · lysine-dev/okhttp@4e884ab · GitHub
Skip to content

Commit 4e884ab

Browse files
authored
retryOnConnectionFailure doesn't impact ECH retries (#9681)
This setting is related to client-triggered retries. ECH retries are related to server teams rolling back ECH settings non-atomically.
1 parent 0433cee commit 4e884ab

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/ConnectPlan.kt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,6 @@ class ConnectPlan internal constructor(
503503
sslSocket: SSLSocket,
504504
sslException: SSLException,
505505
): ConnectPlan? {
506-
if (!retryOnConnectionFailure) return null
507-
508506
// If this was an ECH retry, don't retry again.
509507
if (echRetryPlan != null) return null
510508

@@ -533,6 +531,9 @@ class ConnectPlan internal constructor(
533531
)
534532
}
535533

534+
// If recovery is configured off, don't retry.
535+
if (!retryOnConnectionFailure) return null
536+
536537
// If the exception is not recoverable, don't retry.
537538
if (!attemptAnotherConnectionSpec(sslException)) return null
538539

‎okhttp/src/jvmTest/kotlin/okhttp3/EchOnFakeNetworkTest.kt‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,25 @@ class EchOnFakeNetworkTest {
303303
.isEqualTo("handshake hostname=private.ech.example.com echConfigList=null")
304304
}
305305

306+
/**
307+
* This runs with [OkHttpClient.retryOnConnectionFailure] enabled and disabled. (We always want
308+
* ECH retries, regardless of what this setting is.)
309+
*/
306310
@Test
307-
fun `server updates ech config for retry`() {
311+
fun `server updates ech config for retry`(retryOnConnectionFailure: Boolean) {
308312
val updatedEchConfigList = "new key to encrypt 'private.ech.example.com'".encodeUtf8()
309313
platform.handshaker =
310314
handshakerWithUpdatedEchConfigList(
311315
updatedEchConfigList = updatedEchConfigList,
312316
attemptLimit = 2,
313317
)
314318

319+
client =
320+
client
321+
.newBuilder()
322+
.retryOnConnectionFailure(retryOnConnectionFailure)
323+
.build()
324+
315325
executeHttpExchange()
316326

317327
assertThat(events.take())

0 commit comments

Comments
 (0)