[php-src] PR #15603: feat: enable persistent `CurlShareHandle` objects
| From: | ericnorris | Date: | Tue, 27 Aug 2024 17:47:02 +0000 |
| Subject: | [php-src] PR #15603: feat: enable persistent `CurlShareHandle` objects | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-28225@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/15603
Author: ericnorris
This PR introduces a new function,
curl_share_init_persistent, that creates a
php_curlsh struct that can live beyond a single PHP request.
Persisting a curl share handle would allow PHP userspace to cache things like DNS lookups, or even
entire connections, between multiple PHP requests, thus reducing work for subsequent requests.
I created a new function instead of reusing the existing curl_share_init function since
it also takes an array of curl_share_setopt options to set when the persistent handle
doesn't yet exist.
It is noteworthy that calling curl_share_setopt on the persistent handle would affect future
requests using the handle; we could consider preventing this.
It is also noteworthy that changing the persistent share options would not take effect if the
persistent share already existed; changing the persistent share ID would be sufficient to resolve
that.
I'm open to any feedback whatsoever, including the name! I would also add documentation if
people were amenable to this PR.