mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
Android: Workaround the system certificate issue
Due to removal of local ca-certificates we need to use system's certificate. However, on Android it is stored in multiple files. Ladybird doesn't support multiple certificates yet, so we just concatenate all of them into one big file.
This commit is contained in:
parent
0738852466
commit
f26a898ffc
Notes:
github-actions[bot]
2025-07-10 21:46:13 +00:00
Author: https://github.com/Olekoop
Commit: f26a898ffc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5053
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 23 additions and 1 deletions
|
@ -27,7 +27,7 @@ extern ByteString g_default_certificate_path;
|
|||
ErrorOr<int> service_main(int ipc_socket)
|
||||
{
|
||||
|
||||
RequestServer::g_default_certificate_path = ByteString::formatted("{}/res/ladybird/cacert.pem", WebView::s_ladybird_resource_root);
|
||||
RequestServer::g_default_certificate_path = ByteString::formatted("{}/cacert.pem", WebView::s_ladybird_resource_root);
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
|
|
|
@ -17,7 +17,12 @@ import java.io.BufferedInputStream
|
|||
import java.io.BufferedOutputStream
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.nio.file.Files
|
||||
import java.util.zip.ZipFile
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.inputStream
|
||||
import kotlin.io.path.isDirectory
|
||||
import kotlin.io.path.outputStream
|
||||
|
||||
class LadybirdActivity : AppCompatActivity() {
|
||||
|
||||
|
@ -51,6 +56,19 @@ class LadybirdActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// curl has some issues with the Android's way of storing certificates.
|
||||
// We need to do this in order to make curl happy.
|
||||
val certMain = File("$resourceDir/cacert.pem")
|
||||
certMain.outputStream().use { output ->
|
||||
Files.walk(Path("/system/etc/security/cacerts")).forEach { certPath ->
|
||||
if (!certPath.isDirectory()) {
|
||||
certPath.inputStream().use { input ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val userDir = applicationContext.getExternalFilesDir(null)!!.absolutePath;
|
||||
initNativeCode(resourceDir, "Ladybird", timerService, userDir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue