function CookieJar::getCookiePathFromRequest
Computes cookie path following RFC 6265 section 5.1.4
See also
https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4
1 call to CookieJar::getCookiePathFromRequest()
- CookieJar::extractCookies in vendor/
guzzlehttp/ guzzle/ src/ Cookie/ CookieJar.php - Extract cookies from an HTTP response and store them in the CookieJar.
File
-
vendor/
guzzlehttp/ guzzle/ src/ Cookie/ CookieJar.php, line 248
Class
- CookieJar
- Cookie jar that stores cookies as an array
Namespace
GuzzleHttp\CookieCode
private function getCookiePathFromRequest(RequestInterface $request) : string {
$uriPath = $request->getUri()
->getPath();
if ('' === $uriPath) {
return '/';
}
if (0 !== \strpos($uriPath, '/')) {
return '/';
}
if ('/' === $uriPath) {
return '/';
}
$lastSlashPos = \strrpos($uriPath, '/');
if (0 === $lastSlashPos || false === $lastSlashPos) {
return '/';
}
return \substr($uriPath, 0, $lastSlashPos);
}