Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpClient] improve handling of HTTP/2 PUSH, disable it by default #33444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2019

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Sep 3, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

This follows discussions with @dunglas
For the test cases, https://http2-push.io is down, let's use Akamai instead

This PR now considers the proxy settings before accepting a pushed response.
It also splits the responsibility of dealing with accepting pushed responses in method acceptPushForRequest.

The logic in this method could also be delegated to a userland callback passed as an option. Let's wait for someone with an actual use case before adding the option.

This PR also disables HTTP/2 PUSH by default because it is not stable: locally, with the latest curl version, enabling this on a server that pushes things fails with Failure when receiving data from the peer. This is not ready for prime time in either ext-curl or the underlying libcurl. You can still enable it explicitly by passing some positive number to the constructor.

@nicolas-grekas nicolas-grekas added this to the 4.3 milestone Sep 3, 2019
@nicolas-grekas nicolas-grekas changed the base branch from 4.4 to 4.3 September 3, 2019 12:50
@nicolas-grekas nicolas-grekas force-pushed the hc-push branch 2 times, most recently from 2d20fdd to f5b9d3a Compare September 3, 2019 12:54
src/Symfony/Component/HttpClient/CurlHttpClient.php Outdated Show resolved Hide resolved
@nicolas-grekas nicolas-grekas changed the title [HttpClient] improve handling of HTTP/2 PUSH [HttpClient] improve handling of HTTP/2 PUSH, disable it by default Sep 3, 2019
@@ -50,24 +50,19 @@ public function log($level, $message, array $context = [])
$client = new CurlHttpClient();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this test be updated to opt-in for push, now that it is disabled by default ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, fixed
note that the test doesn't work, but we skip it
I prefer keeping it this way so that we are reminded about it in the future :)

@@ -120,9 +120,6 @@ public function __construct(CurlClientState $multi, $ch, array $options = null,

if (\in_array($waitFor, ['headers', 'destruct'], true)) {
try {
if (\defined('CURLOPT_STREAM_WEIGHT')) {
curl_setopt($ch, CURLOPT_STREAM_WEIGHT, 32);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this closes #32529

nicolas-grekas added a commit that referenced this pull request Sep 3, 2019
…y default (nicolas-grekas)

This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] improve handling of HTTP/2 PUSH, disable it by default

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This follows discussions with @dunglas
For the test cases, https://http2-push.io is down, let's use Akamai instead

This PR now considers the proxy settings before accepting a pushed response.
It also splits the responsibility of dealing with accepting pushed responses in method `acceptPushForRequest`.

The logic in this method could also be delegated to a userland callback passed as an option. Let's wait for someone with an actual use case before adding the option.

This PR also disables HTTP/2 PUSH by default because it is not stable: locally, with the latest curl version, enabling this on a server that pushes things fails with `Failure when receiving data from the peer`. This is not ready for prime time in either ext-curl or the underlying libcurl. You can still enable it explicitly by passing some positive number to the constructor.

Commits
-------

019bce7 [HttpClient] improve handling of HTTP/2 PUSH
@nicolas-grekas nicolas-grekas merged commit 019bce7 into symfony:4.3 Sep 3, 2019
@nicolas-grekas nicolas-grekas deleted the hc-push branch September 3, 2019 19:48
nicolas-grekas added a commit that referenced this pull request Sep 3, 2019
…ndled properly (dunglas)

This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Fix a bug preventing Server Pushes to be handled properly

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Follows #33444.

Commits
-------

e1fbaeb [HttpClient] Fix a bug preventing Server Pushes to be handled properly
@Nyholm
Copy link
Member

Nyholm commented Sep 4, 2019

Thank you

nicolas-grekas added a commit that referenced this pull request Sep 11, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Re-enable Server Push support

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

 #33444 disabled Server Push support for the CURL implementation, but `HttpClient::create()` has been forgotten and override this parameter, consequently for most users Server Push wasn't disabled at all. The root issue affecting the tests are actually a misconfiguration of Akamai servers (we need our own test infrastructure).

According to my testing, Server Push support works very smoothly. Also, it can cause problems only if the server actually pushes responses (which is still rare).

So I propose to re-enable Push Support everywhere.

Commits
-------

8483842 Re-enable push support for HttpClient
@fabpot fabpot mentioned this pull request Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.