Skip to content
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

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

Merged
merged 1 commit into from Sep 3, 2019

Conversation

@nicolas-grekas
Copy link
Member

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 Sep 3, 2019

@nicolas-grekas nicolas-grekas force-pushed the nicolas-grekas:hc-push branch 2 times, most recently from 2d20fdd to f5b9d3a Sep 3, 2019

@nicolas-grekas nicolas-grekas force-pushed the nicolas-grekas:hc-push branch from f5b9d3a to ea0c174 Sep 3, 2019

@nicolas-grekas nicolas-grekas force-pushed the nicolas-grekas:hc-push branch from ea0c174 to 3e56bdf Sep 3, 2019

@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();

This comment has been minimized.

Copy link
@stof

stof Sep 3, 2019

Member

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

This comment has been minimized.

Copy link
@nicolas-grekas

nicolas-grekas Sep 3, 2019

Author Member

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 :)

@nicolas-grekas nicolas-grekas force-pushed the nicolas-grekas:hc-push branch from 3e56bdf to 019bce7 Sep 3, 2019

@@ -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);

This comment has been minimized.

Copy link
@nicolas-grekas

nicolas-grekas Sep 3, 2019

Author Member

this closes #32529

nicolas-grekas added a commit that referenced this pull request Sep 3, 2019
bug #33444 [HttpClient] improve handling of HTTP/2 PUSH, disable it b…
…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

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
fabbot.io Your code looks good.
Details

@nicolas-grekas nicolas-grekas deleted the nicolas-grekas:hc-push branch Sep 3, 2019

nicolas-grekas added a commit that referenced this pull request Sep 3, 2019
minor #33452 [HttpClient] Fix a bug preventing Server Pushes to be ha…
…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

This comment has been minimized.

Copy link
Member

commented Sep 4, 2019

Thank you

nicolas-grekas added a commit that referenced this pull request Sep 11, 2019
bug #33547 [HttpClient] Re-enable Server Push support (dunglas)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.