Skip to content

Add support for transport sharing - #3335

Open
GrahamCampbell wants to merge 2 commits into
aws:masterfrom
GrahamCampbell:transport-sharing
Open

Add support for transport sharing#3335
GrahamCampbell wants to merge 2 commits into
aws:masterfrom
GrahamCampbell:transport-sharing

Conversation

@GrahamCampbell

Copy link
Copy Markdown
Contributor

Guzzle 8 added transport sharing, which lets the built-in handlers share DNS, SSL session, and connection cache state, including persistent cURL share handles on PHP 8.5+ that survive across php-fpm requests. Guzzle 7.11 supports the handler-lifetime subset of the feature. This PR exposes the capability through a new transport_sharing client option with five string modes matching Guzzle's vocabulary: none, handler_prefer, handler_require, persistent_prefer, and persistent_require.

The option's semantics are independent of the installed Guzzle version. The SDK feature-detects what the installed Guzzle supports, degrades the prefer modes gracefully (persistent_prefer falls back to handler-lifetime sharing on Guzzle 7.11+ and to no sharing on older versions), and throws for the require modes when they cannot be honored, so persistent_require is a deployment assertion that connection re-use is actually happening. The option applies when the SDK creates the default HTTP handler, since transport sharing is configured on the Guzzle client constructor rather than per request, and the require modes reject custom handler or http_handler options. Aws\Sdk applies the option to the HTTP handler it shares across the clients it creates. The name transport_sharing mirrors Guzzle's client option; renaming it to http_transport_sharing to group with the other HTTP options would be a two-token change if preferred. A separate commit adds a CI matrix leg pinning Guzzle to >=7.11 <8 so the handler-lifetime degradation path is exercised; it can be dropped if unwanted, since the affected tests skip themselves based on feature detection.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant