v2.1.3
This commit is contained in:
parent
3daee2df53
commit
19ef0566df
610 changed files with 21958 additions and 3112 deletions
34
vendor/guzzlehttp/psr7/src/UriNormalizer.php
vendored
34
vendor/guzzlehttp/psr7/src/UriNormalizer.php
vendored
|
|
@ -189,12 +189,10 @@ final class UriNormalizer
|
|||
return strtoupper($match[0]);
|
||||
};
|
||||
|
||||
return
|
||||
$uri->withPath(
|
||||
preg_replace_callback($regex, $callback, $uri->getPath())
|
||||
)->withQuery(
|
||||
preg_replace_callback($regex, $callback, $uri->getQuery())
|
||||
);
|
||||
return $uri
|
||||
->withPath(self::normalizePercentEncodingInComponent($uri->getPath(), $regex, $callback))
|
||||
->withQuery(self::normalizePercentEncodingInComponent($uri->getQuery(), $regex, $callback))
|
||||
->withFragment(self::normalizePercentEncodingInComponent($uri->getFragment(), $regex, $callback));
|
||||
}
|
||||
|
||||
private static function decodeUnreservedCharacters(UriInterface $uri): UriInterface
|
||||
|
|
@ -205,12 +203,24 @@ final class UriNormalizer
|
|||
return rawurldecode($match[0]);
|
||||
};
|
||||
|
||||
return
|
||||
$uri->withPath(
|
||||
preg_replace_callback($regex, $callback, $uri->getPath())
|
||||
)->withQuery(
|
||||
preg_replace_callback($regex, $callback, $uri->getQuery())
|
||||
);
|
||||
return $uri
|
||||
->withPath(self::normalizePercentEncodingInComponent($uri->getPath(), $regex, $callback))
|
||||
->withQuery(self::normalizePercentEncodingInComponent($uri->getQuery(), $regex, $callback))
|
||||
->withFragment(self::normalizePercentEncodingInComponent($uri->getFragment(), $regex, $callback));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable(array): string $callback
|
||||
*/
|
||||
private static function normalizePercentEncodingInComponent(string $component, string $regex, callable $callback): string
|
||||
{
|
||||
$normalized = preg_replace_callback($regex, $callback, $component);
|
||||
|
||||
if ($normalized === null) {
|
||||
throw new \RuntimeException('Unable to normalize URI component percent-encoding');
|
||||
}
|
||||
|
||||
return $normalized;
|
||||
}
|
||||
|
||||
private function __construct()
|
||||
|
|
|
|||
Loading…
Reference in a new issue