Skip to content

feat(cronet_http): support streaming request bodies on StreamedRequest - #1941

Open
hasanmhallak wants to merge 3 commits into
dart-lang:masterfrom
hasanmhallak:stream-request-cronet
Open

hasanmhallak wants to merge 3 commits into
dart-lang:masterfrom
hasanmhallak:stream-request-cronet

Conversation

@hasanmhallak

Copy link
Copy Markdown
Contributor
  • Add streaming upload support for StreamedRequest in CronetClient using Cronet's UploadDataProvider API instead of buffering the full body with stream.toBytes().
  • Introduce UploadDataProviderProxy (Kotlin) so Dart can implement Cronet's abstract UploadDataProvider via JNI, following the same pattern as UrlRequestCallbackProxy.
  • Regenerate JNI bindings for UploadDataProvider, UploadDataSink, and UploadDataProviderProxy; add package:async for StreamQueue.
  • Keep the existing in-memory upload path for Request bodies unchanged.
  • Enable streamed request body conformance tests (canStreamRequestBody: true).
  • Bump cronet_http to 1.10.0.

relevant #1084


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Note: The Dart team is trialing Gemini Code Assist. Don't take its comments as final Dart team feedback. Use the suggestions if they're helpful; otherwise, wait for a human reviewer.

- Add streaming upload support for `StreamedRequest` in `CronetClient` using Cronet's `UploadDataProvider` API instead of buffering the full body with `stream.toBytes()`.
- Introduce `UploadDataProviderProxy` (Kotlin) so Dart can implement Cronet's abstract `UploadDataProvider` via JNI, following the same pattern as `UrlRequestCallbackProxy`.
- Regenerate JNI bindings for `UploadDataProvider`, `UploadDataSink`, and `UploadDataProviderProxy`; add `package:async` for `StreamQueue`.
- Keep the existing in-memory upload path for `Request` bodies unchanged.
- Enable streamed request body conformance tests (`canStreamRequestBody: true`).
- Bump `cronet_http` to `1.10.0`.
@hasanmhallak

Copy link
Copy Markdown
Contributor Author

any update on this?

@brianquinlan
brianquinlan self-requested a review September 21, 2026 21:36

@brianquinlan brianquinlan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed review, I'm working through the backlog.

Comment thread pkgs/cronet_http/CHANGELOG.md Outdated
Comment thread pkgs/cronet_http/pubspec.yaml Outdated
Comment thread pkgs/cronet_http/lib/src/cronet_client.dart Outdated
Comment thread pkgs/cronet_http/lib/src/cronet_client.dart Outdated
Comment thread pkgs/cronet_http/lib/src/cronet_client.dart Outdated
Comment thread pkgs/cronet_http/lib/src/cronet_client.dart Outdated
Return the upload length from Kotlin so getLength does not block the
Cronet thread, release the JNI refs on the upload callbacks, and always
answer UploadDataSink. Cancel the body stream on failure and close, not
when response headers arrive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants