You are here

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

2 calls to CurlFactory::createRejection()
CurlFactory::finishError in vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
CurlFactory::retryFailedRewind in vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
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"…

File

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

Class

CurlFactory
Creates curl resources from a request

Namespace

GuzzleHttp\Handler

Code

private static function createRejection(EasyHandle $easy, array $ctx) {
  static $connectionErrors = [
    CURLE_OPERATION_TIMEOUTED => true,
    CURLE_COULDNT_RESOLVE_HOST => true,
    CURLE_COULDNT_CONNECT => true,
    CURLE_SSL_CONNECT_ERROR => true,
    CURLE_GOT_NOTHING => true,
  ];

  // If an exception was encountered during the onHeaders event, then
  // return a rejected promise that wraps that exception.
  if ($easy->onHeadersException) {
    return \GuzzleHttp\Promise\rejection_for(new RequestException('An error was encountered during the on_headers event', $easy->request, $easy->response, $easy->onHeadersException, $ctx));
  }
  if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) {
    $message = sprintf('cURL error %s: %s (%s)', $ctx['errno'], $ctx['error'], 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html');
  }
  else {
    $message = sprintf('cURL error %s: %s (%s) for %s', $ctx['errno'], $ctx['error'], 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html', $easy->request
      ->getUri());
  }

  // Create a connection exception if it was a specific error code.
  $error = isset($connectionErrors[$easy->errno]) ? new ConnectException($message, $easy->request, null, $ctx) : new RequestException($message, $easy->request, $easy->response, null, $ctx);
  return \GuzzleHttp\Promise\rejection_for($error);
}