Support HTTPS OHTTP relays in Dart#1532
Conversation
Dart's findProxy grammar rejects HTTPS proxies, but HttpClient can still own CONNECT and response parsing when connectionFactory opens TLS to the relay. Add timeout and URL validation handling plus focused tests for HTTP relays, HTTPS relays, chunk extensions, and invalid schemes.
Coverage Report for CI Build 25516441401Coverage remained the same at 85.169%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
I tested this against the bull bitcoin mobile integration test and it seems to work! At first glance this looks wayyy more sane than #1500 |
Yeah, digging a little deep into why the SDK fails was the trick. The proposed solution works well on our version of the SDK |
spacebear21
left a comment
There was a problem hiding this comment.
tACK 4b6e603
Tested locally against both SatoshiPortal/bullbitcoin-mobile#2041 and against the regression tests I had previously vibecoded for #1500. I feel comfortable not porting all of those tests here because it relies on the dart SDK under the hood which I trust more than the slop in #1500.
@chavic thanks for coming in clutch and approaching this from first principles 🫡
One thing: I wonder if we really need the additional validation in _validateUrl ? It seems more restrictive than the other implementations e.g. fetch_ohttp_keys's IntoUrl in the rust library. Maybe fetchOhttpKeys should just take Uri parameters directly instead of Strings.
|
@spacebear21 Changing |
|
I am so grateful @chavic surfaced this design after looking at the actual SDK! I felt some hesitation from both of us to merge. Regarding
It's actually slightly less restrictive afaict compared to our rust-payjoin/payjoin/src/core/url.rs Lines 433 to 435 in 676ede9 the Dart allowlist's
|
Dropping |
|
dropping |
benalleng
left a comment
There was a problem hiding this comment.
TACK 4b6e603
tested against my bb mobile branch SatoshiPortal/bullbitcoin-mobile#1978 using the payjoin cli from this PR with both sender and receiver flows.
b76b4e6 to
b0da3a4
Compare
|
@DanGould I checked the failing CI against #1536, and this looks like the same macOS Python/Nix environment issue rather than something introduced by the Dart changes here, I think all of those are covered.
PR #1536 appears to address this failure So I think this CI failure is unrelated to the Dart OHTTP relay changes in this PR. Once #1536 lands, rebasing this branch should pick up the fix |
I directed codex to reimplement HTTPS OHTTP relay support in Dart using
HttpClient.connectionFactory, opening TLS to HTTPS relays while leavingCONNECT, response parsing, TLS to the directory, and chunked framing to
Dart's
HttpClient.This avoids owning a custom CONNECT implementation and HTTP response parser
in the Dart bindings. The change also adds timeout handling, URL validation,
relay certificate pinning for local test setups, a response body cap, and
focused tests for HTTP relays, HTTPS relays, chunk extensions, and invalid
relay schemes.
Disclosure: co-authored by Codex