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

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

Issue 11879042: Improve the error-propagation on socket streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 08451ab61b03e7fe00b111f86b0c8f8b624203ac..496a01272884419642c5838b18b08f2bced3b61b 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -751,9 +751,7 @@ abstract class _HttpConnectionBase {
};
_socket.onClosed = _httpParser.streamDone;
_socket.onError = _httpParser.streamError;
- // Ignore errors in the socket output stream as this is getting
- // the same errors as the socket itself.
- _socket.outputStream.onError = (e) => null;
+ _socket.outputStream.onError = _httpParser.streamError;
}
bool _write(List<int> data, [bool copyBuffer = false]);
@@ -876,13 +874,23 @@ class _HttpConnection extends _HttpConnectionBase {
}
void _onError(e) {
- onError(e);
+ // Don't report errors for a request parser when HTTP parser is in
+ // idle state. Clients can close the connection and cause a
+ // connection reset by peer error which is OK.
+ _onClosed();
Mads Ager (google) 2013/01/15 12:39:03 Indentation off by one.
Søren Gjesse 2013/01/15 12:57:45 Not really - did you miss the underscore?
Mads Ager (google) 2013/01/15 13:24:01 I did, yes. Thanks! :-)
+ if (_state == _HttpConnectionBase.IDLE) return;
+
// Propagate the error to the streams.
- if (_request != null && _request._streamErrorHandler != null) {
+ if (_request != null &&
+ !_isRequestDone &&
+ _request._streamErrorHandler != null) {
_request._streamErrorHandler(e);
- }
- if (_response != null && _response._streamErrorHandler != null) {
+ } else if (_response != null &&
+ _isRequestDone &&
Mads Ager (google) 2013/01/15 12:39:03 Could you explain why this isn't !_isResponseDone?
Søren Gjesse 2013/01/15 12:57:45 Artifact of refactoring. Changed to !isResponseDon
+ _response._streamErrorHandler != null) {
_response._streamErrorHandler(e);
+ } else {
+ onError(e);
}
if (_socket != null) _socket.close();
}
« no previous file with comments | « no previous file | sdk/lib/io/http_parser.dart » ('j') | tests/standalone/io/http_server_early_client_close_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698