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

Adding Symfony HttpClient support #37

Merged
merged 4 commits into from
Nov 22, 2019
Merged

Conversation

b-viguier
Copy link
Contributor

Symfony released a new HttpClient component, with support of asynchronous requests and Http2 support. This PR add an adapter for this new HttpClient.

The big change is the support of HTTP2, the examples/03-http-client.php has been adapted to show the performances gain: up to 4x times faster in Http2 🎉 . Of course, this example is an ideal case, where all requests are made on the same server supporting Http2, but it's promising.

Note: Symfony client does not support PSR-7 interfaces natively, then you need to provide some factories (PSR-17)to instantiate PSR-7 responses, https://github.com/Nyholm/http-factory is suggested

@b-viguier
Copy link
Contributor Author

Current status: Travis does not support HTTP/2 example, seems related to curl… I'm trying to see if Sf client is able to fallback to HTTP/1 automatically…

@b-viguier b-viguier force-pushed the feature/sf-http-client branch 4 times, most recently from 204e235 to 03c8fdc Compare November 20, 2019 14:59
@b-viguier
Copy link
Contributor Author

🎉
It took me a while to realize that the bug was in the Guzzle HttpClient!
Symfony performs a smart check to ensure that HTTP/2 is supported (and fallback if necessary), but there is nothing similar in Guzzle, the responsibility seems currently delegated to user according to the HTTP/2 thread.

I copied logic from SF to Guzzle client 😄

@b-viguier b-viguier merged commit 6bb5396 into master Nov 22, 2019
@b-viguier b-viguier deleted the feature/sf-http-client branch November 22, 2019 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants