Skip to content

[HttpClient] Support for non-blocking io in streams #34943

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

Closed
Nek- opened this issue Dec 12, 2019 · 2 comments
Closed

[HttpClient] Support for non-blocking io in streams #34943

Nek- opened this issue Dec 12, 2019 · 2 comments

Comments

@Nek-
Copy link
Contributor

Nek- commented Dec 12, 2019

Description

If I do the following code, I will get an error because Symfony StreamWrapper does not support stream_set_option.

$client = \Symfony\Component\HttpClient\HttpClient::create();
$response = $client->request('GET', 'https://example.com');

$stream = $response->toStream();
\stream_set_blocking($stream, 0); // Trigger error / Returns false
@nicolas-grekas
Copy link
Member

Here is the warning (please add it next time):
PHP Warning: stream_set_blocking(): Symfony\Component\HttpClient\Response\StreamWrapper::stream_set_option is not implemented!

So, let's implement it :)
That's possible only for NativeHttpClient, which is the one that will populate the StreamWrapper::$handle property.

PR welcome.

@Nek-
Copy link
Contributor Author

Nek- commented Jan 6, 2020

#35209 fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants