You are here

private static function CurlFactory::retryFailedRewind in Auth0 Single Sign On 8.2

This function ensures that a response was set on a transaction. If one was not set, then the request is retried if possible. This error typically means you are sending a payload, curl encountered a "Connection died, retrying a fresh connect" error, tried to rewind the stream, and then encountered a "necessary data rewind wasn't possible" error, causing the request to be sent through curl_multi_info_read() without an error status.

1 call to CurlFactory::retryFailedRewind()
CurlFactory::finishError in vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php

File

vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php, line 508

Class

CurlFactory
Creates curl resources from a request

Namespace

GuzzleHttp\Handler

Code

private static function retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx) {
  try {

    // Only rewind if the body has been read from.
    $body = $easy->request
      ->getBody();
    if ($body
      ->tell() > 0) {
      $body
        ->rewind();
    }
  } catch (\RuntimeException $e) {
    $ctx['error'] = 'The connection unexpectedly failed without ' . 'providing an error. The request would have been retried, ' . 'but attempting to rewind the request body failed. ' . 'Exception: ' . $e;
    return self::createRejection($easy, $ctx);
  }

  // Retry no more than 3 times before giving up.
  if (!isset($easy->options['_curl_retries'])) {
    $easy->options['_curl_retries'] = 1;
  }
  elseif ($easy->options['_curl_retries'] == 2) {
    $ctx['error'] = 'The cURL request was retried 3 times ' . 'and did not succeed. The most likely reason for the failure ' . 'is that cURL was unable to rewind the body of the request ' . 'and subsequent retries resulted in the same error. Turn on ' . 'the debug option to see what went wrong. See ' . 'https://bugs.php.net/bug.php?id=47204 for more information.';
    return self::createRejection($easy, $ctx);
  }
  else {
    $easy->options['_curl_retries']++;
  }
  return $handler($easy->request, $easy->options);
}