Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[cupertino_http] StreamedResponse does not close after cancelling the response stream #1758

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
Colton127 opened this issue Apr 25, 2025 · 0 comments · Fixed by #1760
Closed
Assignees
Labels
package:cupertino_http Issues related to package:cupertino_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Colton127
Copy link

In cupertino_http, cancelling the stream on a StreamedResponse does not close the underlying connection.

final client = CupertinoClient.fromSessionConfiguration(URLSessionConfiguration.ephemeralSessionConfiguration());
final request = Request('GET', Uri.parse('https://cachefly.cachefly.net/100mb.test'));
final streamedResponse = await client.send(request);
final streamSubscription = streamedResponse.stream.listen(null);
await Future.delayed(const Duration(seconds: 5));
await streamSubscription.cancel();

After cancelling the stream subscription, the connection remains open until the full body is received:

Image

In contrast, the standard IOClient closes the connection when the stream subscription is cancelled. Notice the "Timespan":

Image

I opened the same issue for cronet_http here.

@Colton127 Colton127 added package:cupertino_http Issues related to package:cupertino_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:cupertino_http Issues related to package:cupertino_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
2 participants