rfc:curl_share_persistence
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:curl_share_persistence [2024/10/09 20:03] – first draft enorris | rfc:curl_share_persistence [2025/01/02 15:08] (current) – add link to curl_share_persistence_improvement RFC enorris | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Add persistent curl share handles ====== | ====== PHP RFC: Add persistent curl share handles ====== | ||
- | * Version: 1.0 | + | * Version: 1.3 |
* Date: 2024-10-09 | * Date: 2024-10-09 | ||
* Author: Eric Norris, erictnorris@gmail.com | * Author: Eric Norris, erictnorris@gmail.com | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
+ | * Superseded by: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 18: | Line 19: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | This RFC proposes to add a new function, '' | + | This RFC proposes to enable users to create persistent curl share handles, by modifying the signature of '' |
- | When called, the function will first check the global memory within the SAPI worker for an existing curl share handle. If found, the function will return immediately. | + | When called |
If a curl share handle does not already exist, the function will construct a new one, apply the given share options, store it in global memory, and return it. | If a curl share handle does not already exist, the function will construct a new one, apply the given share options, store it in global memory, and return it. | ||
- | ==== Why not add persistence to curl_share_init? | + | ==== Safety |
+ | Since curl share handles are stateful, developers must consider whether a given '' | ||
- | I had originally attempted to add a single new optional | + | * '' |
- | + | * '' | |
- | This issue meant that I needed to set the share options only once in userland, which is difficult or impossible to do. I decided to introduce a new function where the PHP extension could safely know if it needed to apply the share options or not. | + | |
- | + | * '' | |
- | At the time of writing the RFC I have come up with a new alternative: | + | |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 39: | Line 40: | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
- | Next PHP '' | + | Next PHP minor release. |
===== RFC Impact ===== | ===== RFC Impact ===== | ||
Line 49: | Line 50: | ||
==== To Existing Extensions ==== | ==== To Existing Extensions ==== | ||
- | '' | + | '' |
==== To Opcache ==== | ==== To Opcache ==== | ||
Line 62: | Line 63: | ||
None. | None. | ||
- | |||
- | ===== Open Issues ===== | ||
- | |||
- | ==== Persistence Implementation ==== | ||
- | |||
- | My first attempt at a pull request used the '' | ||
- | |||
- | Fortunately I was able to come up with an alternative implementation using '' | ||
- | |||
- | ==== curl_share_close Behavior ==== | ||
- | |||
- | From **@kocsismate**: | ||
- | |||
- | < | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | * As noted in the Open Issues, we may want to put together an RFC in the future for a new persistence | + | * We may want to put together an RFC in the future for a new internal API for persistence. |
- | ===== Proposed | + | ===== Voting Choices ===== |
- | This vote would require a ⅔ majority: | + | Voting started on 2024-10-24 and will end on 2024-11-08 00:00 UTC. |
- | ^ Add curl share persistence in the next PHP 8.x ^ | + | This vote requires a ⅔ majority: |
- | | | | + | |
- | This vote would require a simple majority: | + | <doodle title=" |
- | + | * Yes | |
- | ^ Method signature ^^ | + | * No |
- | | curl_share_init_persistent(string $id, array $share_options) | curl_share_init(? | + | </ |
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | * Patch implementing '' | + | * https:// |
===== Implementation ===== | ===== Implementation ===== | ||
Line 103: | Line 89: | ||
* https:// | * https:// | ||
+ | * https:// | ||
===== Rejected Features ===== | ===== Rejected Features ===== | ||
rfc/curl_share_persistence.1728504212.txt.gz · Last modified: 2024/10/09 20:03 by enorris