public function CurlFactory::release in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php \GuzzleHttp\Handler\CurlFactory::release()
Release an easy handle, allowing it to be reused or closed.
This function must call unset on the easy handle's "handle" property.
Parameters
EasyHandle $easy:
Overrides CurlFactoryInterface::release
File
- vendor/
guzzlehttp/ guzzle/ src/ Handler/ CurlFactory.php, line 62
Class
- CurlFactory
- Creates curl resources from a request
Namespace
GuzzleHttp\HandlerCode
public function release(EasyHandle $easy) {
$resource = $easy->handle;
unset($easy->handle);
if (count($this->handles) >= $this->maxHandles) {
curl_close($resource);
}
else {
// Remove all callback functions as they can hold onto references
// and are not cleaned up by curl_reset. Using curl_setopt_array
// does not work for some reason, so removing each one
// individually.
curl_setopt($resource, CURLOPT_HEADERFUNCTION, null);
curl_setopt($resource, CURLOPT_READFUNCTION, null);
curl_setopt($resource, CURLOPT_WRITEFUNCTION, null);
curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null);
curl_reset($resource);
$this->handles[] = $resource;
}
}