File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 1+ ## 1.3.3-wip
2+
3+ * Throw ` ClientException ` if ` CronetClient.send ` runs out of Java heap while
4+ allocating memory for the request body.
5+
16## 1.3.2
27
38* Upgrade ` package:jni ` to 0.10.1 and ` package:jnigen ` to 0.10.0 to fix method
Original file line number Diff line number Diff line change @@ -392,8 +392,22 @@ class CronetClient extends BaseClient {
392392 headers.forEach ((k, v) => builder.addHeader (k.toJString (), v.toJString ()));
393393
394394 if (body.isNotEmpty) {
395+ final JByteBuffer data;
396+ try {
397+ data = body.toJByteBuffer ();
398+ } on JniException catch (e) {
399+ // There are no unit tests for this code. You can verify this behavior
400+ // manually by incrementally increasing the amount of body data in
401+ // `CronetClient.post` until you get this exception.
402+ if (e.message.contains ('java.lang.OutOfMemoryError:' )) {
403+ throw ClientException (
404+ 'Not enough memory for request body: ${e .message }' , request.url);
405+ }
406+ rethrow ;
407+ }
408+
395409 builder.setUploadDataProvider (
396- jb.UploadDataProviders .create2 (body. toJByteBuffer () ), _executor);
410+ jb.UploadDataProviders .create2 (data ), _executor);
397411 }
398412 builder.build ().start ();
399413 return responseCompleter.future;
Original file line number Diff line number Diff line change 11name : cronet_http
2- version : 1.3.2
2+ version : 1.3.3-wip
33description : >-
44 An Android Flutter plugin that provides access to the Cronet HTTP client.
55repository : https://github.com/dart-lang/http/tree/master/pkgs/cronet_http
You can’t perform that action at this time.
0 commit comments