Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: sdk/lib/io/http_impl.dart

Issue 23479022: Make sure to never report SocketExceptions on HttpResponse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/http_server_close_response_after_error_client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index a7cac9fdb064182a571f82ee4603df23f77a46e5..c5897efc7508c5e37a06752c0368cbb65c772385 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -570,6 +570,9 @@ class _HttpOutboundConsumer implements StreamConsumer {
}
}
+ bool _ignoreError(error)
+ => error is SocketException && _outbound is HttpResponse;
+
_ensureController() {
if (_controller != null) return;
_controller = new StreamController(sync: true,
@@ -585,8 +588,7 @@ class _HttpOutboundConsumer implements StreamConsumer {
},
onError: (error) {
_socketError = true;
- if (error is SocketException &&
- _outbound is HttpResponse) {
+ if (_ignoreError(error)) {
_cancel();
_done();
_closeCompleter.complete(_outbound);
@@ -637,7 +639,9 @@ class _HttpOutboundConsumer implements StreamConsumer {
Future close() {
Future closeOutbound() {
if (_socketError) return new Future.value(_outbound);
- return _outbound._close().then((_) => _outbound);
+ return _outbound._close()
+ .catchError((_) {}, test: _ignoreError)
+ .then((_) => _outbound);
}
if (_controller == null) return closeOutbound();
_controller.close();
« no previous file with comments | « no previous file | tests/standalone/io/http_server_close_response_after_error_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698