| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 // Global constants. | 7 // Global constants. |
| 8 class _Const { | 8 class _Const { |
| 9 // Bytes for "HTTP". | 9 // Bytes for "HTTP". |
| 10 static const HTTP = const [72, 84, 84, 80]; | 10 static const HTTP = const [72, 84, 84, 80]; |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 assert(_bodyController == null); | 875 assert(_bodyController == null); |
| 876 _bodyController = new StreamController<List<int>>( | 876 _bodyController = new StreamController<List<int>>( |
| 877 onSubscriptionStateChange: _bodySubscriptionStateChange, | 877 onSubscriptionStateChange: _bodySubscriptionStateChange, |
| 878 onPauseStateChange: _updateParsePauseState); | 878 onPauseStateChange: _updateParsePauseState); |
| 879 _incoming = new _HttpIncoming( | 879 _incoming = new _HttpIncoming( |
| 880 _headers, transferLength, _bodyController.stream); | 880 _headers, transferLength, _bodyController.stream); |
| 881 _pauseParsing(); // Needed to handle detaching - don't start on the body! | 881 _pauseParsing(); // Needed to handle detaching - don't start on the body! |
| 882 } | 882 } |
| 883 | 883 |
| 884 void _closeIncoming() { | 884 void _closeIncoming() { |
| 885 assert(_incoming != null); | 885 // Ignore multiple close (can happend in re-entrance). |
| 886 if (_incoming == null) return; |
| 886 var tmp = _incoming; | 887 var tmp = _incoming; |
| 887 _incoming = null; | 888 _incoming = null; |
| 888 tmp.close(); | 889 tmp.close(); |
| 889 if (_bodyController != null) { | 890 if (_bodyController != null) { |
| 890 _bodyController.close(); | 891 _bodyController.close(); |
| 891 _bodyController = null; | 892 _bodyController = null; |
| 892 } | 893 } |
| 893 _updateParsePauseState(); | 894 _updateParsePauseState(); |
| 894 } | 895 } |
| 895 | 896 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 StreamController<_HttpIncoming> _controller; | 971 StreamController<_HttpIncoming> _controller; |
| 971 StreamController<List<int>> _bodyController; | 972 StreamController<List<int>> _bodyController; |
| 972 } | 973 } |
| 973 | 974 |
| 974 | 975 |
| 975 class HttpParserException implements Exception { | 976 class HttpParserException implements Exception { |
| 976 const HttpParserException([String this.message = ""]); | 977 const HttpParserException([String this.message = ""]); |
| 977 String toString() => "HttpParserException: $message"; | 978 String toString() => "HttpParserException: $message"; |
| 978 final String message; | 979 final String message; |
| 979 } | 980 } |
| OLD | NEW |