Skip to content

Latest commit

 

History

History
72 lines (58 loc) · 5.48 KB

header-optimization.md

File metadata and controls

72 lines (58 loc) · 5.48 KB

Header optimization implementation

This document connects the header-optimization specification to the implementation in this repository. It is informative: deviations recorded here do not weaken the generic contract.

Public API

AlternatorConfig exposes optimizeHeaders, headersWhitelist, and computed required-header sets. Client builders infer authentication and user-agent enablement and combine those settings with compression requirements.

Internal architecture

HeadersFilteringSdkHttpClient and HeadersFilteringSdkAsyncHttpClient rebuild each outgoing request with allowed headers. Their normalized whitelist snapshots use locale-independent lowercase matching.

User-agent transformation is performed by UserAgentSdkHttpClient and UserAgentSdkAsyncHttpClient.

Lifecycle and concurrency

Attempt-routing wrappers are outermost, so they consume invocation metadata before header filtering removes it. Header filters wrap user-agent transforms and the main transport. Closing the outer transport delegates through each wrapper to the underlying transport. Polling clients are configured separately and are not wrapped by main-transport filtering.

Requirement mapping

Requirement Code Test evidence Status
HEAD-REQ-001 HeadersFilteringSdkHttpClient FeatureSpecDefaultsTest#headerOptimizationDefaultMatchesSpecification conformant
HEAD-REQ-002 AlternatorConfig AlternatorConfigHeadersTest#testFullHeadersWhitelistContents gap
HEAD-REQ-003 AlternatorConfig AlternatorConfigHeadersTest#testCustomWhitelistMissingRequiredHeadersThrows gap
HEAD-REQ-004 AlternatorDynamoDbClient AlternatorDynamoDbClientCustomizerTest#testWithAlternatorConfigEnablesDefaultUserAgentTransformer gap
HEAD-REQ-005 HeadersFilteringSdkAsyncHttpClient HeadersFilteringSdkAsyncHttpClientTest#testPreservesMetricCollector gap
HEAD-REQ-006 HeadersFilteringSdkAsyncHttpClient HeadersFilteringSdkAsyncHttpClientTest#testFiltersNonWhitelistedHeaders gap

Test coverage

Known conformance gaps

  • HEAD-REQ-002: The computed authentication whitelist contains only Authorization and X-Amz-Date. It drops X-Amz-Security-Token for temporary credentials and cannot automatically preserve extra headers introduced by a custom signer. Tests use only basic credentials.
  • HEAD-REQ-003: A non-empty custom whitelist containing null reaches validation and throws NullPointerException; empty entries are accepted when all required headers are present. Validation also uses the process default locale, so ASCII-equivalent casing can fail under locales such as Turkish.
  • HEAD-REQ-004: Per-attempt routing can change the transport URI after signing while retaining an earlier Host and Authorization; see the query-plan implementation details.
  • HEAD-REQ-005, HEAD-REQ-006: Blocking filtering and user-agent wrappers drop the request metric collector. Non-blocking filtering and user-agent wrappers drop HTTP execution attributes. Direct tests do not exercise these fields.