-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: share connection & DNS Cache to CURLRequest
#9557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.7
Are you sure you want to change the base?
Conversation
This is a nice improvement, but I think it would benefit from being more configurable. How about introducing a We should also note in the user guide that the It's a bit unfortunate that we already have |
In new function persistent that avoid cookie, we avoid too? |
Do you mean |
8d5fe45
to
3c20b47
Compare
<?php
$optShareConnection = [
CURL_LOCK_DATA_CONNECT,
CURL_LOCK_DATA_DNS,
];
$this->shareConnection = curl_share_init();
foreach (array_unique($optShareConnection) as $opt) {
curl_share_setopt($this->shareConnection, CURLSHOPT_SHARE, $opt);
} same as persistent implementation in next PR (when ready): <?php
$optShareConnection = [
CURL_LOCK_DATA_CONNECT,
CURL_LOCK_DATA_DNS,
];
$this->shareConnection = curl_share_init_persistent($optShareConnection); |
CURLRequest
CURLRequest
if ($optShareConnection !== []) { | ||
$this->shareConnection = curl_share_init(); | ||
|
||
foreach (array_unique($optShareConnection) as $opt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the array_unique needed? If yes, please add a test to cover this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When i see persistent logic in PHP 8.5, automatically remove duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant applied test to see content object CURLOPT_SHARE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When i see persistent logic in PHP 8.5, automatically remove duplicate
sorry, I did not understand you here. do you mean PHP 8.5 automatically remove duplicates?
Co-authored-by: Michal Sniatala <[email protected]>
80cca03
to
251d092
Compare
Description
I need this for reuse connection. As soon PHP 8.5 will have new function for persistent, Benefit choosing persistent_id by PHP (read more on RFC).
php/php-src@d20880c#diff-6db2da0f77fa4c56808260fdf566a723bbb52d6159077953097d05d995335558R135-R245
https://wiki.php.net/rfc/curl_share_persistence_improvement
Checklist: