Chromium Code Reviews| 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(); |
| } |