Fix #1951 update guzzlehttp/guzzle to 6.5.6

This commit is contained in:
Kijin Sung 2022-06-09 21:02:16 +09:00
parent d0cdcb5d2a
commit 8d26ca1a90
21 changed files with 402 additions and 89 deletions

View file

@ -240,6 +240,11 @@ class CookieJar implements CookieJarInterface
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);
}
}

View file

@ -333,12 +333,19 @@ class SetCookie
*/
public function matchesDomain($domain)
{
$cookieDomain = $this->getDomain();
if (null === $cookieDomain) {
return true;
}
// Remove the leading '.' as per spec in RFC 6265.
// http://tools.ietf.org/html/rfc6265#section-5.2.3
$cookieDomain = ltrim($this->getDomain(), '.');
$cookieDomain = ltrim(strtolower($cookieDomain), '.');
$domain = strtolower($domain);
// Domain not set or exact match.
if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) {
if ('' === $cookieDomain || $domain === $cookieDomain) {
return true;
}