-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Breaking Change Request] Support abort() in HttpClientRequest in Dart:IO #41904
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
lgtm, @franklinyow can you enquire with partner teams? |
cc @Hixie @matanlurey @vsmenon for review and approval. |
An |
Based on some discussion in draft cl, abort() now will accept two optional parameters. Users are allowed to provide customized exception and stackTrace, which will trigger onError() callback. |
SGTM. |
A friendly ping. @matanlurey @vsmenon |
lgtm |
1 similar comment
lgtm |
Mark Approved |
The breaking change request for this cl: #41904 Bug: #22265 Change-Id: I36db64b4db307b78cd188a2f1701ec733f2e73db Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147339 Commit-Queue: Zichang Guo <[email protected]> Reviewed-by: Lasse R.H. Nielsen <[email protected]>
This reverts commit 4b96f20. Reason for revert: Windows bots are broken. Because --socket-short-read is specified, the server doesn't receive full header at once. https://dart-ci.appspot.com/log/vm-kernel-win-debug-x64/dartk-win-debug-x64/8907/standalone_2/io/http_client_connect_test/3 Original change's description: > [dart:io] Add Abort() on HttpClientRequest > > The breaking change request for this cl: #41904 > > Bug: #22265 > Change-Id: I36db64b4db307b78cd188a2f1701ec733f2e73db > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147339 > Commit-Queue: Zichang Guo <[email protected]> > Reviewed-by: Lasse R.H. Nielsen <[email protected]> [email protected],[email protected] Change-Id: I48f7a2ee3bb75e0e0ba0bd24ed53fcac372e016d No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: #22265 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155548 Reviewed-by: Zichang Guo <[email protected]> Commit-Queue: Zichang Guo <[email protected]>
The test was poorly written. The response from Socket can arrive separately. So the check for content-length header will fail. This is a reland of 4b96f20 Original change's description: > [dart:io] Add Abort() on HttpClientRequest > > The breaking change request for this cl: #41904 > > Bug: #22265 > Change-Id: I36db64b4db307b78cd188a2f1701ec733f2e73db > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147339 > Commit-Queue: Zichang Guo <[email protected]> > Reviewed-by: Lasse R.H. Nielsen <[email protected]> Bug: #22265 Change-Id: Ibfe9565a3f9d5ef84274fba33a68fb57dbbe28c9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155581 Reviewed-by: Siva Annamalai <[email protected]> Commit-Queue: Zichang Guo <[email protected]>
Summary
With current APIs in Dart:IO, there is no way to abort the
HttpClientRequest
. OnceHttpClientRequest
has been sent, the request cannot be canceled untilHttpClientResponse
comes back. See the example below:Abort() will allow users to stop waiting for
HttpClientResponse
, so users can abort the request if it takes too long.Function signature
The intended behavior
close()
will complete withexception
andstackTrace
if abort() is called prior toHttpClientResponse
being available. The default value forexception
andstackTrace
will beHttpException
andStackTrace.empty
.IOSink
's API after abort().HttpClientResponse
returning beforeabort
, abort() will not make any effect.Expected use case
Expected impact
All classes extends or implements
HttpClientRequest
in Dart:IO will need to update accordingly.Proposed Implementation
https://dart-review.googlesource.com/c/sdk/+/147339
Relative discussions
#22265
The text was updated successfully, but these errors were encountered: