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
Add IPv4 fallback on connection timeout, and adds COMPOSER_IPRESOLVE env var #11791
Conversation
@stof thanks, all feedback should be addressed. |
@@ -143,7 +143,7 @@ public function download(callable $resolve, callable $reject, string $origin, st | |||
/** | |||
* @param mixed[] $options | |||
* | |||
* @param array{retryAuthFailure?: bool, redirects?: int<0, max>, retries?: int<0, max>, storeAuth?: 'prompt'|bool} $attributes | |||
* @param array{retryAuthFailure?: bool, redirects?: int<0, max>, retries?: int<0, max>, storeAuth?: 'prompt'|bool, ipResolve?: 4|6|null} $attributes |
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.
can't make up your mind whether to use |null or ? and here you use both? ;-)
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.
It's optional to pass it but it defaults to null so yeah this looks weird but works well enough
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.
The ?
after a key does not indicate nullability but the fact that this key is optional in the array.
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.
Looks good!
@@ -199,6 +206,12 @@ private function initDownload(callable $resolve, callable $reject, string $origi | |||
curl_setopt($curlHandle, CURLOPT_ENCODING, ""); // let cURL set the Accept-Encoding header to what it supports | |||
curl_setopt($curlHandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); | |||
|
|||
if ($attributes['ipResolve'] === 4) { | |||
curl_setopt($curlHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
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.
curl_setopt($curlHandle, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, 0);
When using the IPv4 protocol, is it possible to change the default 200ms wait for IPv6 to 0ms?
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.
if resolution is forced to be ipv4, there won't be any happy eyeballs happening, so this timeout won't ever be used.
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.
Yeah that would be my expectation as well, so I don't think this is necessary.
fixes composer/packagist#530