Skip to content

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

Closed
@Colton127

Description

@Colton127

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.

Metadata

Metadata

Assignees

Labels

package:cupertino_httpIssues related to package:cupertino_httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions