Small update in our internal terminology

This commit is contained in:
Nyholm 2020-06-07 14:29:13 +02:00 committed by Nicolas Grekas
parent 2121c55b02
commit 00682acdea
2 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
$options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use ($onProgress, $subnets, &$lastPrimaryIp): void {
if ($info['primary_ip'] !== $lastPrimaryIp) {
if (IpUtils::checkIp($info['primary_ip'], $subnets ?? self::PRIVATE_SUBNETS)) {
throw new TransportException(sprintf('IP "%s" is blacklisted for "%s".', $info['primary_ip'], $info['url']));
throw new TransportException(sprintf('IP "%s" is blocked for "%s".', $info['primary_ip'], $info['url']));
}
$lastPrimaryIp = $info['primary_ip'];

View File

@ -22,7 +22,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
class NoPrivateNetworkHttpClientTest extends TestCase
{
public function getBlacklistData(): array
public function getExcludeData(): array
{
return [
// private
@ -63,16 +63,16 @@ class NoPrivateNetworkHttpClientTest extends TestCase
}
/**
* @dataProvider getBlacklistData
* @dataProvider getExcludeData
*/
public function testBlacklist(string $ipAddr, $subnets, bool $mustThrow)
public function testExclude(string $ipAddr, $subnets, bool $mustThrow)
{
$content = 'foo';
$url = sprintf('http://%s/', 0 < substr_count($ipAddr, ':') ? sprintf('[%s]', $ipAddr) : $ipAddr);
if ($mustThrow) {
$this->expectException(TransportException::class);
$this->expectExceptionMessage(sprintf('IP "%s" is blacklisted for "%s".', $ipAddr, $url));
$this->expectExceptionMessage(sprintf('IP "%s" is blocked for "%s".', $ipAddr, $url));
}
$previousHttpClient = $this->getHttpClientMock($url, $ipAddr, $content);