Skip to content

Commit

Permalink
bug #30755 [HttpClient] correctly clean state on destruct in CurlResp…
Browse files Browse the repository at this point in the history
…onse (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
-------

332a88c [HttpClient] correctly clean state on destruct in CurlResponse
  • Loading branch information
nicolas-grekas committed Mar 28, 2019
2 parents c30f462 + 332a88c commit efb6414
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpClient/Response/CurlResponse.php
Expand Up @@ -231,7 +231,7 @@ protected static function perform(\stdClass $multi, array &$responses = null): v

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;
Expand Down

0 comments on commit efb6414

Please sign in to comment.