-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Add support for ECH on Android 37 #9383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yschimke
wants to merge
49
commits into
square:master
Choose a base branch
from
yschimke:testing_ech
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
4f8e286
Testing ECH in Android Platform
yschimke e21fd68
More testing
yschimke 8b062b8
Fixes
yschimke 292d40a
Merge branch 'master' into testing_ech
yschimke 5b46c86
Fixes
yschimke 7e08fcb
Fixes
yschimke 9692d67
Fixes
yschimke 7ec38bf
Fixes
yschimke 33c62cd
More fixes
yschimke 2ea576e
More fixes
yschimke cc06a75
More fixes
yschimke cbecbaa
More fixes
yschimke 487bc99
Refactor
yschimke 2d8237e
Merge branch 'master' into testing_ech
yschimke 7029d12
Android API 37
yschimke ae060bb
Testing with robolectric also
yschimke dc0f8ca
Merge branch 'master' into testing_ech
yschimke 1a05f84
More fixes
yschimke e034658
Fix ECH branch CI failures
yschimke 04f4a43
Avoid AGP source set cast for android tests
yschimke 8702756
Permit localhost cleartext in Android tests
yschimke ffe3d69
Document ECH public APIs
yschimke b2652bb
Harden Android ECH support
yschimke ccde3d3
Temporarily focus CI on Android API 37
yschimke 1b74946
Use explicit adb path for Android 37 CI
yschimke d71c148
Fix Android 37 cleanup workflow syntax
yschimke 1fb1f76
Split Android 37 CI into separate job
yschimke 5febd47
Wait for Android 37 package services
yschimke b890bb3
Try Android 37 Play Store system image
yschimke ec7e36d
Isolate Android 37 emulator job
yschimke 892472b
Initialize OkHttp in public suffix Android test
yschimke 72742fe
Re-enable regular build jobs
yschimke 8cd005f
Restore conditional build job gates
yschimke 994fe6f
Pin Android 37 workflow actions
yschimke 6276a39
Merge branch 'master' into testing_ech
yschimke 6ea7990
Merge branch 'master' into testing_ech
yschimke 4e61bab
Address ECH PR review feedback
yschimke 16f1ec7
Use google_apis_playstore_ps16k image for API 37
yschimke fa55cb0
Fix EchAware visibility so it compiles
yschimke cb2a521
Add experimental AsyncDns for HTTPS/SVCB + ECH (foundation)
yschimke 43e605c
Inline the android37 emulator job with the 16 KB system image
yschimke 2099333
Move API 37 into the android matrix job
yschimke 5839d9f
Suppress NewApi lint for AndroidAsyncDns DnsResolver constructor
yschimke 3b3043e
AndroidAsyncDns: query A/AAAA/HTTPS separately, add addressesOnly
yschimke 05f6306
Make ECH types experimental public API
yschimke ad2e3de
Keep ECH and AsyncDns internal instead of experimental public API
yschimke 11f85d5
Carry ECH state on RealCall fields instead of tags
yschimke e652838
Resolve ECH via a call-aware internal DNS path; drop EchAware
yschimke 18bd5dc
Merge pull request #24 from yschimke/agent/ech-review-fixes
yschimke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
android-test/src/androidTest/java/okhttp/android/test/EchTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * Copyright (c) 2026 OkHttp Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package okhttp.android.test | ||
|
|
||
| import assertk.assertThat | ||
| import assertk.assertions.isNotNull | ||
| import assertk.assertions.matchesPredicate | ||
| import okhttp3.OkHttpClient | ||
| import okhttp3.Request | ||
| import okhttp3.Response | ||
| import org.junit.jupiter.api.Tag | ||
| import org.junit.jupiter.api.Test | ||
|
|
||
| @Tag("Remote") | ||
| class EchTest { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NEAT |
||
|
|
||
| @Test | ||
| fun testHttpsRequest() { | ||
| val client: OkHttpClient = | ||
| OkHttpClient | ||
| .Builder() | ||
| .build() | ||
|
|
||
| val cloudflareEchBody = | ||
| client.sendRequest(Request.Builder().url("https://cloudflare-ech.com/").build()) { | ||
| it.body.string() | ||
| } | ||
| assertThat(cloudflareEchBody).matchesPredicate { it.contains("ECH enabled") } | ||
|
|
||
| val cloudflareBody = client.sendRequest( | ||
| Request.Builder().url("https://crypto.cloudflare.com/cdn-cgi/trace").build() | ||
| ) { | ||
| it.body.string() | ||
| } | ||
| assertThat(cloudflareBody).matchesPredicate { it.contains("ECH enabled") } | ||
|
|
||
| val tlsEchBody = client.sendRequest(Request.Builder().url("https://tls-ech.dev/").build()) { | ||
| it.body.string() | ||
| } | ||
| assertThat(tlsEchBody).matchesPredicate { it.contains("ECH enabled") } | ||
| } | ||
|
|
||
| private fun <T> OkHttpClient.sendRequest(request: Request, fn: (Response) -> T): T { | ||
| val response = newCall(request).execute() | ||
|
|
||
| return response.use { | ||
| fn(it) | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| sdk=36 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20 minutes? woof