Small update in our internal terminology
This commit is contained in:
parent
2121c55b02
commit
00682acdea
@ -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 {
|
$options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use ($onProgress, $subnets, &$lastPrimaryIp): void {
|
||||||
if ($info['primary_ip'] !== $lastPrimaryIp) {
|
if ($info['primary_ip'] !== $lastPrimaryIp) {
|
||||||
if (IpUtils::checkIp($info['primary_ip'], $subnets ?? self::PRIVATE_SUBNETS)) {
|
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'];
|
$lastPrimaryIp = $info['primary_ip'];
|
||||||
|
@ -22,7 +22,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
|
|||||||
|
|
||||||
class NoPrivateNetworkHttpClientTest extends TestCase
|
class NoPrivateNetworkHttpClientTest extends TestCase
|
||||||
{
|
{
|
||||||
public function getBlacklistData(): array
|
public function getExcludeData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
// private
|
// 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';
|
$content = 'foo';
|
||||||
$url = sprintf('http://%s/', 0 < substr_count($ipAddr, ':') ? sprintf('[%s]', $ipAddr) : $ipAddr);
|
$url = sprintf('http://%s/', 0 < substr_count($ipAddr, ':') ? sprintf('[%s]', $ipAddr) : $ipAddr);
|
||||||
|
|
||||||
if ($mustThrow) {
|
if ($mustThrow) {
|
||||||
$this->expectException(TransportException::class);
|
$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);
|
$previousHttpClient = $this->getHttpClientMock($url, $ipAddr, $content);
|
||||||
|
Reference in New Issue
Block a user