feat(ads-client): add OHTTP support (AC-94)#7315
Open
Almaju wants to merge 2 commits intomozilla:mainfrom
Open
feat(ads-client): add OHTTP support (AC-94)#7315Almaju wants to merge 2 commits intomozilla:mainfrom
Almaju wants to merge 2 commits intomozilla:mainfrom
Conversation
5654d59 to
b9cd744
Compare
e1f3556 to
0e85300
Compare
c3fbfd1 to
4662ae9
Compare
Add per-request OHTTP support via the `ohttp` flag on `MozAdsRequestOptions` and `MozAdsCallbackOptions`. When enabled, individual MARS requests are routed through viaduct's OHTTP layer with automatic preflight for geo/user-agent override headers. - Add `ohttp: bool` parameter to fetch_ads, record_click, record_impression, report_ad and all public API methods - Add `MozAdsCallbackOptions` FFI type for callback OHTTP support - Add `mars/preflight.rs` with PreflightRequest/PreflightResponse types - Preflight responses cached via HttpCache (CacheFirst with default TTL) - Add `FetchAdsError::Preflight` variant for preflight failures - Add OHTTP integration test against prod - Update usage docs for all platforms (JavaScript, Kotlin, Swift)
4662ae9 to
a2297b9
Compare
copyrighthero
left a comment
There was a problem hiding this comment.
Great work! A quick comment is whether we should include the ohttp option into the cache key!
Isolate HTTP/cache/OHTTP concerns into MARSTransport, keeping MARSClient focused on MARS domain logic (request building, response parsing, preflight headers, callbacks). - Add MARSTransport with send() (cached + deserialized) and fire() (direct, no cache, no body) methods - Move client_for, OHTTP_CHANNEL_ID, cache management into transport - Add ohttp flag to AdRequest Hash impl for distinct cache keys - Rename check_http_status_for_error to HTTPError::check - Introduce TransportError, sort error enums alphabetically - Add clear_cache back to AdsClient after accidental removal
Contributor
Author
|
@copyrighthero I added ohttp key to the AdRequest hash and also isolated the client/send logic into a MARSTransport module, I think it looks cleaner 96fa046 |
copyrighthero
approved these changes
Apr 17, 2026
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.
Summary
ohttp: boolfield toMozAdsRequestOptionsand newMozAdsCallbackOptions { ohttp: bool }to opt individual requests into OHTTP routingrequest_tile_ads,request_image_ads,request_spoc_ads,record_impression,record_click,report_adoptionsparameters use UniFFI defaults so existing callers require no changesOHTTP_CHANNEL_IDfromhttp_cacheintoclient— http_cache is now generic and has no ads-client knowledge#[uniffi(default = None/false)]to optional fields acrossMozAdsPlacementRequest,MozAdsCacheConfig,MozAdsRequestCachePolicyfor better ergonomics in consumer codedocs/usage.mdinto per-language files (usage-javascript.md,usage-kotlin.md,usage-swift.md) with correct language-specific examplesviaduct'sohttpfeature depends on NSS)test_contract_tile_ohttp_prodagainst production MARS over OHTTPPull Request checklist
[ci full]to the PR title.