bug #30755 [HttpClient] correctly clean state on destruct in CurlResponse (nicolas-grekas)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] correctly clean state on destruct in CurlResponse

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30753
| License       | MIT
| Doc PR        | -

On destruct, we ask curl to close the stream once the headers arrived, but we don't silence the "error" this sets in curl. This fixes it.

Commits
-------

332a88c8ce [HttpClient] correctly clean state on destruct in CurlResponse
This commit is contained in:
Nicolas Grekas 2019-03-28 17:34:47 +01:00
commit efb6414f6b

View File

@ -231,7 +231,7 @@ final class CurlResponse implements ResponseInterface
while ($info = curl_multi_info_read($multi->handle)) {
$multi->handlesActivity[(int) $info['handle']][] = null;
$multi->handlesActivity[(int) $info['handle']][] = \in_array($info['result'], [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) ? null : new TransportException(curl_error($info['handle']));
$multi->handlesActivity[(int) $info['handle']][] = \in_array($info['result'], [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || (\CURLE_WRITE_ERROR === $info['result'] && 'destruct' === @curl_getinfo($info['handle'], CURLINFO_PRIVATE)) ? null : new TransportException(curl_error($info['handle']));
}
} finally {
self::$performing = false;