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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 }, | 203 }, |
204 onPause: () { | 204 onPause: () { |
205 _paused = true; | 205 _paused = true; |
206 _pauseStateChanged(); | 206 _pauseStateChanged(); |
207 }, | 207 }, |
208 onResume: () { | 208 onResume: () { |
209 _paused = false; | 209 _paused = false; |
210 _pauseStateChanged(); | 210 _pauseStateChanged(); |
211 }, | 211 }, |
212 onCancel: () { | 212 onCancel: () { |
213 try { | 213 if (_socketSubscription != null) { |
214 _socketSubscription.cancel(); | 214 _socketSubscription.cancel(); |
215 } catch (e) { | |
216 } | 215 } |
217 }); | 216 }); |
218 _reset(); | 217 _reset(); |
219 } | 218 } |
220 | 219 |
221 | 220 |
222 StreamSubscription<_HttpIncoming> listen(void onData(_HttpIncoming event), | 221 StreamSubscription<_HttpIncoming> listen(void onData(_HttpIncoming event), |
223 {Function onError, | 222 {Function onError, |
224 void onDone(), | 223 void onDone(), |
225 bool cancelOnError}) { | 224 bool cancelOnError}) { |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 _HttpHeaders _headers; | 981 _HttpHeaders _headers; |
983 | 982 |
984 // The current incoming connection. | 983 // The current incoming connection. |
985 _HttpIncoming _incoming; | 984 _HttpIncoming _incoming; |
986 StreamSubscription _socketSubscription; | 985 StreamSubscription _socketSubscription; |
987 bool _paused = true; | 986 bool _paused = true; |
988 bool _bodyPaused = false; | 987 bool _bodyPaused = false; |
989 StreamController<_HttpIncoming> _controller; | 988 StreamController<_HttpIncoming> _controller; |
990 StreamController<List<int>> _bodyController; | 989 StreamController<List<int>> _bodyController; |
991 } | 990 } |
OLD | NEW |