This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component
Nicolas Grekas 74ac5421b2 feature #35566 [HttpClient] adding NoPrivateNetworkHttpClient decorator (hallboav)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpClient] adding NoPrivateNetworkHttpClient decorator

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

The purpose of NoPrivateNetworkHttpClient is for block requests to private networks by default or block one or more subnetwork if specified. NoPrivateNetworkHttpClient accepts two arguments, first one is a HttpClientInterface instance and subnetworks as a second argument.
Second argument $subnets can be null for blocking requests to private networks, or string to specify a single subnet of array for a set of subnets.

```php
<?php

use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\NoPrivateNetworkHttpClient;

$client = new NoPrivateNetworkHttpClient(HttpClient::create());
// You can request public networks normally using the code above
$client->request('GET', 'https://symfony.com/');

// Requests to private neworks will be blocked because second argument ($subnets) is null
$client->request('GET', 'http://localhost/');

// If we request from 104.26.14.0 to 104.26.15.255 we'll get an exception, since I'm specifying a subnetwork
$client = new NoPrivateNetworkHttpClient(HttpClient::create(), ['104.26.14.0/23']);

// Let's suppose that our DNS server resolves symfony.com to 104.26.14.6, then the following request will be blocked
$client->request('GET', 'https://symfony.com/');
```

Commits
-------

63fec805f4 [HttpClient] adding NoPrivateNetworkHttpClient decorator
2020-02-03 17:39:39 +01:00
..
Asset Merge branch '5.0' 2020-01-04 15:20:45 +01:00
BrowserKit Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Cache Merge branch '5.0' 2020-01-31 10:20:53 +01:00
Config Merge branch '5.0' 2020-02-03 14:51:48 +01:00
Console Merge branch '5.0' 2020-02-03 14:51:48 +01:00
CssSelector [CssSelector] Added cache on top of CssSelectorConverter 2020-01-27 15:56:28 +01:00
DependencyInjection Merge branch '5.0' 2020-02-03 14:51:48 +01:00
DomCrawler Merge branch '5.0' 2020-02-03 14:51:48 +01:00
Dotenv [Dotenv] Add Dotenv::bootEnv() to check for .env.local.php before calling Dotenv::loadEnv() 2020-01-28 12:41:19 +01:00
ErrorHandler Merge branch '5.0' 2020-01-31 10:20:53 +01:00
EventDispatcher Merge branch '5.0' 2020-01-10 22:57:55 +01:00
ExpressionLanguage Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Filesystem Merge branch '5.0' 2020-01-21 09:44:52 +01:00
Finder Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Form feature #35205 [Form] derive the view timezone from the model timezone (xabbuh) 2020-01-07 20:12:15 +01:00
HttpClient feature #35566 [HttpClient] adding NoPrivateNetworkHttpClient decorator (hallboav) 2020-02-03 17:39:39 +01:00
HttpFoundation Merge branch '3.4' into 4.4 2020-02-03 09:22:04 +01:00
HttpKernel feature #35560 [HttpKernel] allow using public aliases to reference controllers (nicolas-grekas) 2020-02-03 17:34:59 +01:00
Inflector Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Intl Merge branch '5.0' 2020-01-31 10:20:53 +01:00
Ldap Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Lock Merge branch '5.0' 2020-01-31 10:20:53 +01:00
Mailer Merge branch '5.0' 2020-01-31 10:20:53 +01:00
Messenger Merge branch '5.0' 2020-01-31 10:20:53 +01:00
Mime Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Notifier [Notifier] Fix infinite loop on round robin transport 2020-01-30 16:19:41 +01:00
OptionsResolver Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Process Merge branch '5.0' 2020-01-09 10:56:45 +01:00
PropertyAccess Rebase, fix tests, review & update CHANGELOG 2020-01-28 10:54:57 +01:00
PropertyInfo Rebase, fix tests, review & update CHANGELOG 2020-01-28 10:54:57 +01:00
Routing Merge branch '3.4' into 4.4 2020-02-03 09:22:04 +01:00
Security Merge branch '5.0' 2020-01-31 10:20:53 +01:00
Serializer Added scalar denormalization in Serializer + added scalar normalization tests 2020-01-13 11:50:29 +03:00
Stopwatch Merge branch '5.0' 2020-01-04 15:20:45 +01:00
String [String] Made AbstractString::width() follow POSIX.1-2001 2020-01-23 11:37:52 +01:00
Templating Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Translation Merge branch '5.0' 2020-01-21 09:44:52 +01:00
Validator Merge branch '5.0' 2020-01-31 10:20:53 +01:00
VarDumper Improve displaying anonymous classes 2020-01-26 14:13:42 +01:00
VarExporter Merge branch '5.0' 2020-01-04 15:20:45 +01:00
WebLink Merge branch '5.0' 2020-01-04 15:20:45 +01:00
Workflow [Workflow] Added a way to not fire the annonce event 2020-01-13 14:50:42 +01:00
Yaml Merge branch '5.0' 2020-02-03 14:51:48 +01:00