fix: default primp mobile requests to GaiResolver#81
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes the
primpmobile recipe so ordinary Android HTTPS requests no longer abort natively on first use.Resolves flet-dev/flet#6603
Cause
primpis built with thehickory-dnsfeature enabled. Inprimp-reqwest, that makes Hickory the default DNS resolver when the caller does not provide one.On Android, Hickory’s system DNS configuration path calls into
ndk-contextto access the AndroidContext. Flet loadsprimpas a Python extension throughserious_python, and that Rust Android context is not initialized there. As a result, the first network request can abort the process with:This happens below Python, so the app can crash before a Python exception can be raised or caught.
Fix
The recipe patch now changes the Python binding’s client builder behavior for mobile builds:
dns_resolver, keep using that resolverGaiResolveras the default resolverThis routes normal hostname resolution through the platform
getaddrinfopath and avoids Hickory’s Androidndk-contextsystem-DNS path. Explicit DoH/DoT/plain resolver support remains available.The recipe test now performs a real HTTPS request and asserts that the request path either completes or raises a Python-level request error, rather than aborting the process.