Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CookieJar.php

function CookieJar::extractCookies

Overrides CookieJarInterface::extractCookies

File

vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php, line 222

Class

CookieJar
Cookie jar that stores cookies as an array

Namespace

GuzzleHttp\Cookie

Code

public function extractCookies(RequestInterface $request, ResponseInterface $response) : void {
    if ($cookieHeader = $response->getHeader('Set-Cookie')) {
        foreach ($cookieHeader as $cookie) {
            $sc = SetCookie::fromString($cookie);
            if (!$sc->getDomain()) {
                $sc->setDomain($request->getUri()
                    ->getHost());
            }
            if (0 !== \strpos($sc->getPath(), '/')) {
                $sc->setPath($this->getCookiePathFromRequest($request));
            }
            if (!$sc->matchesDomain($request->getUri()
                ->getHost())) {
                continue;
            }
            // Note: At this point `$sc->getDomain()` being a public suffix should
            // be rejected, but we don't want to pull in the full PSL dependency.
            $this->setCookie($sc);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal