Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/trusted-server-adapter-axum/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use trusted_server_core::proxy::{
handle_first_party_proxy_sign,
};
use trusted_server_core::publisher::{
AuctionDispatch, buffer_publisher_response_async, handle_page_bids, handle_publisher_request,
AuctionDispatch, DeliveryCompressionCapability, PublisherAdapterOptions,
buffer_publisher_response_async, handle_page_bids, handle_publisher_request,
handle_tsjs_dynamic, page_bids_preflight_denied,
};
use trusted_server_core::request_signing::{
Expand Down Expand Up @@ -216,7 +217,10 @@ async fn dispatch_fallback(
&mut ec_context,
auction,
req,
EdgeCacheHeader::SMaxageFallback,
PublisherAdapterOptions {
edge_cache_header: EdgeCacheHeader::SMaxageFallback,
delivery_compression: DeliveryCompressionCapability::Unavailable,
},
)
.await?;
// Async finalize so the dispatched auction is collected and its bids are
Expand Down
10 changes: 7 additions & 3 deletions crates/trusted-server-adapter-cloudflare/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ use trusted_server_core::proxy::{
handle_first_party_proxy_sign,
};
use trusted_server_core::publisher::{
AuctionDispatch, PublisherResponse, buffer_publisher_response_async, handle_page_bids,
handle_publisher_request, handle_tsjs_dynamic, page_bids_preflight_denied,
AuctionDispatch, DeliveryCompressionCapability, PublisherAdapterOptions, PublisherResponse,
buffer_publisher_response_async, handle_page_bids, handle_publisher_request,
handle_tsjs_dynamic, page_bids_preflight_denied,
};
use trusted_server_core::request_signing::{
handle_trusted_server_discovery, handle_verify_signature,
Expand Down Expand Up @@ -406,7 +407,10 @@ fn build_router(state: &Arc<AppState>) -> RouterService {
&mut ec_context,
auction,
req,
EdgeCacheHeader::CloudflareCdnCacheControl,
PublisherAdapterOptions {
edge_cache_header: EdgeCacheHeader::CloudflareCdnCacheControl,
delivery_compression: DeliveryCompressionCapability::Unavailable,
},
)
.await
{
Expand Down
6 changes: 5 additions & 1 deletion crates/trusted-server-adapter-fastly/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ use trusted_server_core::proxy::{
use trusted_server_core::publisher::{
buffer_publisher_response_async, handle_page_bids, handle_publisher_request,
handle_tsjs_dynamic, page_bids_preflight_denied, AuctionDispatch,
DeliveryCompressionCapability, PublisherAdapterOptions,
};
use trusted_server_core::request_signing::{
handle_deactivate_key, handle_rotate_key, handle_trusted_server_discovery,
Expand Down Expand Up @@ -795,7 +796,10 @@ async fn dispatch_fallback(
&mut ec.ec_context,
auction,
req,
EdgeCacheHeader::SurrogateControl,
PublisherAdapterOptions {
edge_cache_header: EdgeCacheHeader::SurrogateControl,
delivery_compression: DeliveryCompressionCapability::FastlyDynamic,
},
)
.await
{
Expand Down
10 changes: 7 additions & 3 deletions crates/trusted-server-adapter-spin/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ use trusted_server_core::proxy::{
handle_first_party_proxy_sign,
};
use trusted_server_core::publisher::{
AuctionDispatch, PublisherResponse, buffer_publisher_response_async, handle_page_bids,
handle_publisher_request, handle_tsjs_dynamic, page_bids_preflight_denied,
AuctionDispatch, DeliveryCompressionCapability, PublisherAdapterOptions, PublisherResponse,
buffer_publisher_response_async, handle_page_bids, handle_publisher_request,
handle_tsjs_dynamic, page_bids_preflight_denied,
};
use trusted_server_core::request_signing::{
handle_trusted_server_discovery, handle_verify_signature,
Expand Down Expand Up @@ -672,7 +673,10 @@ fn build_router(state: &Arc<AppState>) -> RouterService {
&mut ec_context,
auction,
req,
EdgeCacheHeader::SMaxageFallback,
PublisherAdapterOptions {
edge_cache_header: EdgeCacheHeader::SMaxageFallback,
delivery_compression: DeliveryCompressionCapability::Unavailable,
},
)
.await
{
Expand Down
32 changes: 32 additions & 0 deletions crates/trusted-server-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,38 @@ mod tests {
);
}

#[test]
fn wrapper_omits_disabled_ssat_compression_offload_for_legacy_compatibility() {
let mut settings = valid_settings();
settings.publisher.ssat_compression_offload_enabled = false;
let app_config =
TrustedServerAppConfig::new(settings).expect("should build disabled app config");
let value =
serde_json::to_value(&app_config).expect("should serialize disabled app config");
let publisher = value
.get("publisher")
.and_then(serde_json::Value::as_object)
.expect("should serialize publisher settings");

assert!(
!publisher.contains_key("ssat_compression_offload_enabled"),
"disabled setting must be omitted so older runtimes can load the config"
);

let mut settings = valid_settings();
settings.publisher.ssat_compression_offload_enabled = true;
let app_config =
TrustedServerAppConfig::new(settings).expect("should build enabled app config");
let value = serde_json::to_value(&app_config).expect("should serialize enabled app config");
assert_eq!(
value
.get("publisher")
.and_then(|publisher| publisher.get("ssat_compression_offload_enabled")),
Some(&serde_json::Value::Bool(true)),
"enabled setting must remain present in the published config"
);
}

#[test]
fn wrapper_deserializes_from_settings_shape() {
let toml = crate_test_settings_str();
Expand Down
Loading
Loading