Commit Graph

51124 Commits

Author SHA1 Message Date
Nicolas Grekas
5e48c1e1c6 Merge branch '5.1'
* 5.1:
  [HttpClient] Always "buffer" empty responses
2020-10-02 16:25:10 +02:00
Nicolas Grekas
c453c3dbd5 Merge branch '4.4' into 5.1
* 4.4:
  [HttpClient] Always "buffer" empty responses
2020-10-02 16:24:03 +02:00
Nicolas Grekas
700462f118 [HttpClient] fix last fix 2020-10-02 16:15:25 +02:00
Nicolas Grekas
993525a366 [HttpClient] Fix dealing with empty responses in AsyncResponse 2020-10-02 16:11:19 +02:00
Nicolas Grekas
1f7b8fdf7b bug #38378 [HttpClient] Fix exception triggered with AsyncResponse (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] Fix exception triggered with AsyncResponse

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/38289#issuecomment-702573975
| License       | MIT
| Doc PR        | /

When a request is replayed with the AsyncResponse and the 2nd request failed, users get an exception even when they pass `$throw=false`.

In fact, there are 2 exceptions:

1. Cannot get the content of the response twice: buffering is disabled.

73ca97c97a/src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php (L51-L68)

Because CommonResponseTrait::$content is null and `self::stream` yield only the LastChunk. The content is stays null

2. HTTP/2 429  returned for "https://httpbin.org/status/429"

73ca97c97a/src/Symfony/Component/HttpClient/Response/AsyncResponse.php (L209-L225)

Because on the second request passthru is null, it didn't disable the the exception thrown on destruct for the wrapped response.
This

Commits
-------

3aedb51dd8 [HttpClient] Fix exception triggered with AsyncResponse
2020-10-02 15:57:56 +02:00
Jérémy Derussé
3aedb51dd8 [HttpClient] Fix exception triggered with AsyncResponse 2020-10-02 15:57:08 +02:00
Nicolas Grekas
b3a20e4065 bug #38388 [HttpClient] Always "buffer" empty responses (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] Always "buffer" empty responses

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

Commits
-------

03d60fce47 [HttpClient] Always "buffer" empty responses
2020-10-02 15:47:43 +02:00
Nicolas Grekas
03d60fce47 [HttpClient] Always "buffer" empty responses 2020-10-02 15:41:48 +02:00
Fabien Potencier
a3e8c112c2 feature #38323 [Mime] Allow multiple parts with the same name in FormDataPart (HypeMC)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Mime] Allow multiple parts with the same name in FormDataPart

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

Added the possibility to choose whether multiple parts with the same name should be suffixed or not:

```php
$f1 = new FormDataPart([
    'foo' => [
        'one',
        'two',
    ],
]);

var_dump($f1->toString());
```

```
Content-Type: multipart/form-data; boundary=6rqazwiG

--6rqazwiG
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="foo[0]"

one
--6rqazwiG
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="foo[1]"

two
--6rqazwiG--
```

```php
$f1 = new FormDataPart([
    ['foo' => 'one'],
    ['foo' => 'two'],
]);

var_dump($f1->toString());
```

```
Content-Type: multipart/form-data; boundary=xxW9dGzq

--xxW9dGzq
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="foo"

one
--xxW9dGzq
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="foo"

two
--xxW9dGzq--
```

Only applies to numeric keys:

```php
$f1 = new FormDataPart([
    'foo' => [
        'a' => 'one',
        'b' => 'two',
    ],
], true);

var_dump($f1->toString());
```

```
Content-Type: multipart/form-data; boundary=W6qkqgrD

--W6qkqgrD
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="foo[a]"

one
--W6qkqgrD
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="foo[b]"

two
--W6qkqgrD--
```

Commits
-------

1f7f2c6ddc Allow multiple parts with the same name in FormDataPart
2020-10-02 15:33:43 +02:00
Nicolas Grekas
9d6333a7ff Merge branch '5.1'
* 5.1:
  [5.1] Ignore more deprecations for Mockery mocks
  [PhpUnitBridge] Fix Deprecation file when it comes from the TestsListener
  disallow FrameworkBundle 4.4+
  propagate validation groups to subforms
  [Form] [Validator] Add failing testcase to demonstrate group sequence issue
2020-10-02 15:09:26 +02:00
Nicolas Grekas
af3d50851f minor #38386 [5.1] Ignore more deprecations for Mockery mocks (fancyweb)
This PR was merged into the 5.1 branch.

Discussion
----------

[5.1] Ignore more deprecations for Mockery mocks

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

Continuation of https://github.com/symfony/symfony/pull/38377 on 5.1.

Commits
-------

58e6cb1ddc [5.1] Ignore more deprecations for Mockery mocks
2020-10-02 15:08:52 +02:00
Thomas Calvet
58e6cb1ddc [5.1] Ignore more deprecations for Mockery mocks 2020-10-02 15:05:43 +02:00
Nicolas Grekas
8ae323b8a7 bug #38384 [PhpUnitBridge] Fix Deprecation file when it comes from the TestsListener (fancyweb)
This PR was merged into the 5.1 branch.

Discussion
----------

[PhpUnitBridge] Fix Deprecation file when it comes from the TestsListener

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

https://github.com/symfony/symfony/pull/38031 caused an unwanted regression: if the frame `class` matches `SymfonyTestsListenerFor` it used to always return, now it continues so the `originClass` and `originMethod` properties are set. Therefore, the deprecation is considered as coming from the test listener. It ends up in the "legacy" group and muted because the test listeners contains the word "Legacy" in their namespaces.

Example test:
```php
<?php

namespace App\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\DependencyInjection\ExtractingEventDispatcher;

final class FooTest extends TestCase
{
    public function test(): void
    {
        // ExtractingEventDispatcher is @internal
        new class extends ExtractingEventDispatcher {};

        $this->assertTrue(true);
    }
}
```

On 4.4:
```
Other deprecation notices (1)

  1x: The "Symfony\Component\EventDispatcher\DependencyInjection\ExtractingEventDispatcher" class is considered internal. It may change without further notice. You should not use it from "Symfony\Component\EventDispatcher\DependencyInjection\ExtractingEventDispatcher@anonymous".
```

On 5.1:
```
Legacy deprecation notices (1)
```

Commits
-------

1ba06a0f86 [PhpUnitBridge] Fix Deprecation file when it comes from the TestsListener
2020-10-02 14:58:44 +02:00
Nicolas Grekas
8ea3e7a6bb Merge branch '4.4' into 5.1
* 4.4:
  disallow FrameworkBundle 4.4+
  propagate validation groups to subforms
  [Form] [Validator] Add failing testcase to demonstrate group sequence issue
2020-10-02 14:58:01 +02:00
Thomas Calvet
1ba06a0f86 [PhpUnitBridge] Fix Deprecation file when it comes from the TestsListener 2020-10-02 14:57:56 +02:00
Nicolas Grekas
3d39874a2c Merge branch '3.4' into 4.4
* 3.4:
  disallow FrameworkBundle 4.4+
  propagate validation groups to subforms
  [Form] [Validator] Add failing testcase to demonstrate group sequence issue
2020-10-02 14:43:11 +02:00
Nicolas Grekas
4be56f6932 bug #38380 [Form] propagate validation groups to subforms (johanderuijter, xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] propagate validation groups to subforms

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38300
| License       | MIT
| Doc PR        |

Commits
-------

04f5698e29 propagate validation groups to subforms
e2c7c3373d [Form] [Validator] Add failing testcase to demonstrate group sequence issue
2020-10-02 14:37:04 +02:00
Nicolas Grekas
60bfdaa6b8 minor #38383 [FrameworkBundle] disallow FrameworkBundle 4.4+ (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] disallow FrameworkBundle 4.4+

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

Since #34619 (merged in 4.4.1) the request stack can no longer be passed as an argument to the `HtmlErrorRenderer` constructor. However, FrameworkBundle 4.4 refuses to be used with WebProfilerBundle 3.4 since #34369 (merged in 4.4.0-RC1).

Commits
-------

ad45e9cfdd disallow FrameworkBundle 4.4+
2020-10-02 14:28:27 +02:00
Christian Flothmann
ad45e9cfdd disallow FrameworkBundle 4.4+ 2020-10-02 14:18:20 +02:00
Fabien Potencier
bd8c3c1c42 feature #38354 [RateLimiter] add Limit::ensureAccepted() which throws RateLimitExceededException if not accepted (kbond)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[RateLimiter] add Limit::ensureAccepted() which throws RateLimitExceededException if not accepted

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Ref https://github.com/symfony/symfony/issues/38241#issuecomment-695212027
| License       | MIT
| Doc PR        | todo

Example:

```php
try {
    $limit = $limiter->consume()->ensureAccepted();
} catch (RateLimitExceededException $e) {
    $limit = $e->getLimit();
}
```

Commits
-------

a7ecd0ed08 [RateLimiter] add Limit::ensureAccepted() and RateLimitExceededException
2020-10-02 13:18:49 +02:00
Nicolas Grekas
48adfb2e4b Merge branch '5.1'
* 5.1:
  [HttpClient] fix unsetting context[ssl][peer_name]
2020-10-02 12:20:36 +02:00
Nicolas Grekas
56679fe735 Merge branch '4.4' into 5.1
* 4.4:
  [HttpClient] fix unsetting context[ssl][peer_name]
2020-10-02 12:20:30 +02:00
Nicolas Grekas
71875397e9 minor #38379 [HttpClient] fix unsetting context[ssl][peer_name] (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix unsetting context[ssl][peer_name]

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no (fixing a not released fix)
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix https://github.com/symfony/symfony/pull/38375#issuecomment-702621658
| License       | MIT
| Doc PR        | -

/cc @bohanyang could you please confirm this fixes it?

Commits
-------

8eb8a7c400 [HttpClient] fix unsetting context[ssl][peer_name]
2020-10-02 12:19:29 +02:00
Nicolas Grekas
8eb8a7c400 [HttpClient] fix unsetting context[ssl][peer_name] 2020-10-02 12:07:58 +02:00
Christian Flothmann
04f5698e29 propagate validation groups to subforms 2020-10-02 11:43:30 +02:00
Johan de Ruijter
e2c7c3373d [Form] [Validator] Add failing testcase to demonstrate group sequence issue
When using group sequences on a form, sometimes constraints are ignored even though they should fail.
2020-10-02 11:43:30 +02:00
HypeMC
1f7f2c6ddc Allow multiple parts with the same name in FormDataPart 2020-10-02 11:11:56 +02:00
Nicolas Grekas
73ca97c97a Merge branch '5.1'
* 5.1:
  [HttpClient] fix using proxies with NativeHttpClient
  [4.4] Ignore more deprecations for Mockery mocks
  [Routing] fix using !important and defaults/reqs in inline route definitions
  [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes
  [HttpClient] Fix using https with proxies
  [TwigBundle] Only remove kernel exception listener if twig is used
  [DI] Fix changelog
  Remove CHANGELOG files for 4.x
  Adjust expired range check
  Fix redis connection error message
  [DI] fix dumping non-shared lazy services
2020-10-02 10:56:13 +02:00
Nicolas Grekas
d8255138ae Merge branch '4.4' into 5.1
* 4.4:
  [HttpClient] fix using proxies with NativeHttpClient
  [4.4] Ignore more deprecations for Mockery mocks
  [Routing] fix using !important and defaults/reqs in inline route definitions
  [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes
  [HttpClient] Fix using https with proxies
  [TwigBundle] Only remove kernel exception listener if twig is used
  Adjust expired range check
  Fix redis connection error message
2020-10-02 10:49:02 +02:00
Nicolas Grekas
0d8721fc01 Merge branch '3.4' into 4.4
* 3.4:
  Adjust expired range check
2020-10-02 10:38:15 +02:00
Nicolas Grekas
3cfd991ae6 bug #38377 [4.4] Ignore more deprecations for Mockery mocks (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[4.4] Ignore more deprecations for Mockery mocks

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

Commits
-------

1a801e8452 [4.4] Ignore more deprecations for Mockery mocks
2020-10-02 10:36:26 +02:00
Nicolas Grekas
aca260fbd0 bug #38375 [HttpClient] fix using proxies with NativeHttpClient (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix using proxies with NativeHttpClient

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

As spotted by @stof in https://github.com/symfony/symfony/pull/38368#issuecomment-702272737, we cannot use local DNS resolution with HTTP proxies.

Commits
-------

28f301bf03 [HttpClient] fix using proxies with NativeHttpClient
2020-10-02 10:29:59 +02:00
Nicolas Grekas
9c8a3009cf bug #38372 [Routing] fix using !important and defaults/reqs in inline route definitions (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing] fix using !important and defaults/reqs in inline route definitions

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #33224
| License       | MIT
| Doc PR        | -

Commits
-------

826db225b7 [Routing] fix using !important and defaults/reqs in inline route definitions
2020-10-02 10:22:10 +02:00
Nicolas Grekas
28f301bf03 [HttpClient] fix using proxies with NativeHttpClient 2020-10-02 10:17:19 +02:00
Thomas Calvet
1a801e8452 [4.4] Ignore more deprecations for Mockery mocks 2020-10-02 09:34:48 +02:00
Fabien Potencier
d0ded920e6 bug #38367 [RateLimiter] Fix cache storage (use namespaced pool + remove \Serializable) (wouterj)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[RateLimiter] Fix cache storage (use namespaced pool + remove \Serializable)

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38365, fix #38338
| License       | MIT
| Doc PR        | -

Commits
-------

251c202874 Use a dedicated cache.rate_limiter cache pool
5dc562a318 Use __sleep/__wakeup instead of Serializable
2020-10-02 08:02:03 +02:00
Fabien Potencier
67a7be2bd0 Fix CS 2020-10-02 07:59:23 +02:00
Fabien Potencier
954009a4d7 feature #32904 [Messenger] Added ErrorDetailsStamp (TimoBakx)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Messenger] Added ErrorDetailsStamp

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32311
| License       | MIT
| Doc PR        | No doc changes are needed

#SymfonyHackday

This PR is part of the work started in #32341. That PR has a workaround for showing exceptions added to a previous retry. This PR stores error messages in a separate stamp, so they're more easily accessed.

I also added the exceptionClass as a separate string (independant of FlattenException), so that information is always available, even if the trace is not (due to FlattenException not being available).

Duplicated exceptions (compared to the last one) are not stored separately.

**Questions:**
- Should we limit the total amount of exceptions (remove the oldest when adding a new one)?
  - Yes, but in a new PR
- The current implementation adds this stamp in the Worker instead of the listeners to prevent duplicate code (due to the immutability of the envelope in the event). Is this the proper way to do this?
  - No, create a new listener and a way to add stamps to the envelope inside the event.
- When adding details of a `HandlerFailedException`, should we add a stamp per wrapped `Throwable`? There can be multiple errors wrapped by a single `HandlerFailedException`.
  - Yes, but in a later PR

**Todo:**
- [x] only add new information if it differs from the previous exception
- [x] add deprecations
- [x] fall back to old stamp data if no new stamp is available
- [x] rebase and retarget to master
- [x] update CHANGELOG.md
- [x] check for docs PR

**BC Breaks:**
When this PR is merged, RedeliveryStamps will no longer be populated with exception data. Any implementations that use `RedeliveryStamp::getExceptionMessage()` or `RedeliveryStamp::getFlattenedException()` will receive an empty string or `null` respectively for stamps added after this update. They should rely on `ErrorDetailsStamp` instead.

**New stuff:**
- New stamp `ErrorDetailsStamp`.
- New event subscriber `AddErrorDetailsStampListener`.
- New method `AbstractWorkerMessageEvent::addStamps`.

Commits
-------

cd27b863f9 [Messenger] Added FailedMessageErrorDetailsStamp
2020-10-02 07:56:41 +02:00
Fabien Potencier
14942dbbe8 feature #36152 [Messenger] dispatch event when a message is retried (nikophil)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Messenger] dispatch event when a message is retried

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

Hello,

i'm working on a bundle which helps to monitor messenger queues (add some stats for queues/transports + ability to manage failed messages from the browser)
https://github.com/SymfonyCasts/messenger-monitor-bundle/

and we're missing some hooks in the messaging system:
1. a way to know when a message has been retried (fixed by dispatching a new `WorkerMessageRetriedEvent` in `SendFailedMessageForRetryListener::onMessageFailed()`)
2. a way to update the enveloppe in worker message events (fixed by adding `AbstractWorkerMessageEvent::setEnvelope()`)

if needed i can provide some precise use cases.

thanks.

Commits
-------

55bddcb721 [Messenger] dispatch event when a message is retried
2020-10-02 07:48:00 +02:00
Nicolas PHILIPPE
55bddcb721 [Messenger] dispatch event when a message is retried 2020-10-02 07:47:55 +02:00
Fabien Potencier
1b88b8beaf feature #38361 Can define ChatMessage transport to null (odolbeau)
This PR was submitted for the 5.1 branch but it was merged into the 5.2-dev branch instead.

Discussion
----------

Can define ChatMessage transport to null

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

I'm using notiier & messenger together to send notification asynchronously.

In order to have json messages in my broker, here is the messenger config I use:
```yaml
        serializer:
            default_serializer: messenger.transport.symfony_serializer
            symfony_serializer:
                format: json
                context: { }
```

I send a new `ChatMessage`:

```php
use Symfony\Component\Notifier\ChatterInterface;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatter->send(new ChatMessage('Using notifier & messenger together is amazing!');
```

Message is correctly sent to my broker, in json:

```json
{
  "subject": "Using notifier & messenger together is amazing!",
  "recipientId": null,
  "options": null,
  "transport": null,
  "notification": null
}
```

But when I want to consume it, as the `transport` method used by the serializer to create the `ChatMessage` doesn't accept `null` value, I get the following error:

```
  [Symfony\Component\Messenger\Exception\MessageDecodingFailedException]
  Could not decode message: Failed to denormalize attribute "transport" value for class "Symfony\Component\Notifier\Message\ChatMessage": Expected argument of type "string", "null" given at property path "transport".
```

This PR correct the problem, even if I'm not sure it's the best way to go...

Commits
-------

09c9bde479 Can define ChatMessage transport to null
2020-10-02 07:42:06 +02:00
Olivier Dolbeau
09c9bde479 Can define ChatMessage transport to null 2020-10-02 07:42:01 +02:00
Fabien Potencier
b35bbdbde5 feature #38289 [HttpClient] provide response body to the RetryDecider (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] provide response body to the RetryDecider

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes but for not-yet released 5.2 feature
| Tickets       | /
| License       | MIT
| Doc PR        | TODO

Some servers, like AWS, does not always return standard HTTP code. The strategy needs to parse the body to take a decision.
example:
```
400
x-amzn-requestid: XXXXX
content-type: application/x-amz-json-1.1
content-length: 58
date: Thu, 24 Sep 2020 11:17:35 GMT
connection: close

{"__type":"ThrottlingException","message":"Rate exceeded"}
````

This PR update the `RetryDeciderInterface` interface to let the decider notifying the Client when it need the body to take a decision. in that case, the Client, fetch te client, and call again the decider with the full body.

usage
```php
class Decider implements RetryDeciderInterface {
    public function shouldRetry(string $requestMethod, string $requestUrl, array $requestOptions, int $responseCode, array $responseHeaders, ?string $responseContent, \Throwable $throwable = null): ?bool
    {
        if (null !== $throwable) {
            return true;
        }
        if (in_array($responseCode, [423, 425, 429, 500, 502, 503, 504, 507, 510])) {
            return true;
        }
        if (
            $responseCode !== 400
            || $headers['content-type'][0] ?? null !== 'application/x-amz-json-1.1'
            || (int) $headers['content-length'][0] ?? '0' > 1024
        ) {
            return false;
        }
        if (null === $responseContent) {
            return null; // null mean no decision taken and need to be called again with the body
        }

        $data = json_decode($responseContent, true);

        return $data['__type'] ?? '' === 'ThrottlingException';
    }
}
```

Commits
-------

321be5884d [HttpClient] provide response body to the RetryDecider
2020-10-02 07:36:08 +02:00
Fabien Potencier
9a5a856b18 bug #38373 [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/37916
| License       | MIT
| Doc PR        | -

Commits
-------

bbd12fe27f [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes
2020-10-02 07:33:00 +02:00
Kevin Bond
a7ecd0ed08
[RateLimiter] add Limit::ensureAccepted() and RateLimitExceededException 2020-10-01 20:04:22 -04:00
Nicolas Grekas
826db225b7 [Routing] fix using !important and defaults/reqs in inline route definitions 2020-10-01 18:25:17 +02:00
Thomas Calvet
bbd12fe27f [ErrorHandler][DebugClassLoader] Do not check Mockery mocks classes 2020-10-01 18:21:20 +02:00
Nicolas Grekas
abe0ecac91 bug #38368 [HttpClient] Fix using https with proxies (bohanyang)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[HttpClient] Fix using https with proxies

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

According to my test, when `request_fulluri` is set to true,
the host appears in the URL will be the Host header,
even if the Host header is set in the context http header.

Since HttpClient has its own DNS cache, the host inside the URL is usually an IP address.
So this can break many things.
```
{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Accept-Encoding": "gzip",
    "Host": "3.211.1.78",
    "User-Agent": "Symfony HttpClient/Native",
    "X-Amzn-Trace-Id": "Root=1-5f75a59e-62c8c81e4490e09c700d6180"
  },
  "origin": "xxx.xxx.xxx.xxx",
  "url": "https://3.211.1.78/get"
}
* Hostname was NOT found in DNS cache
* Added httpbin.org:0:3.211.1.78 to DNS cache
* Establish HTTP proxy tunnel to tcp://10.22.22.21:7777
> GET https://3.211.1.78/get HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Host: httpbin.org
User-Agent: Symfony HttpClient/Native

< HTTP/1.1 200 OK
< Date: Thu, 01 Oct 2020 09:47:10 GMT
< Content-Type: application/json
< Content-Length: 300
< Connection: close
< Server: gunicorn/19.9.0
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
<
```

I've also found this https://github.com/guzzle/guzzle/issues/791

We can also create an option to make it customizable.

Commits
-------

7e0cd4e621 [HttpClient] Fix using https with proxies
2020-10-01 18:05:35 +02:00
Bohan Yang
7e0cd4e621 [HttpClient] Fix using https with proxies 2020-10-01 18:05:21 +02:00
Jérémy Derussé
321be5884d
[HttpClient] provide response body to the RetryDecider 2020-10-01 17:55:44 +02:00