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\CookieCode
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);
}
}
}