You are here

private function CurlFactory::applyMethod in Auth0 Single Sign On 8.2

1 call to CurlFactory::applyMethod()
CurlFactory::create in vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
Creates a cURL handle resource.

File

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

Class

CurlFactory
Creates curl resources from a request

Namespace

GuzzleHttp\Handler

Code

private function applyMethod(EasyHandle $easy, array &$conf) {
  $body = $easy->request
    ->getBody();
  $size = $body
    ->getSize();
  if ($size === null || $size > 0) {
    $this
      ->applyBody($easy->request, $easy->options, $conf);
    return;
  }
  $method = $easy->request
    ->getMethod();
  if ($method === 'PUT' || $method === 'POST') {

    // See http://tools.ietf.org/html/rfc7230#section-3.3.2
    if (!$easy->request
      ->hasHeader('Content-Length')) {
      $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0';
    }
  }
  elseif ($method === 'HEAD') {
    $conf[CURLOPT_NOBODY] = true;
    unset($conf[CURLOPT_WRITEFUNCTION], $conf[CURLOPT_READFUNCTION], $conf[CURLOPT_FILE], $conf[CURLOPT_INFILE]);
  }
}