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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
8 final int _transferLength; | 8 final int _transferLength; |
9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 }, | 573 }, |
574 onError: (error) { | 574 onError: (error) { |
575 if (!_done(error)) { | 575 if (!_done(error)) { |
576 _closeCompleter.completeError(error); | 576 _closeCompleter.completeError(error); |
577 } | 577 } |
578 }); | 578 }); |
579 } | 579 } |
580 | 580 |
581 bool _done([error]) { | 581 bool _done([error]) { |
582 if (_completer == null) return false; | 582 if (_completer == null) return false; |
583 var tmp = _completer; | 583 if (error != null) { |
| 584 _completer.completeError(error); |
| 585 } else { |
| 586 _completer.complete(_outbound); |
| 587 } |
584 _completer = null; | 588 _completer = null; |
585 if (error != null) { | |
586 tmp.completeError(error); | |
587 } else { | |
588 tmp.complete(_outbound); | |
589 } | |
590 return true; | 589 return true; |
591 } | 590 } |
592 | 591 |
593 Future addStream(var stream) { | 592 Future addStream(var stream) { |
594 _ensureController(); | 593 _ensureController(); |
595 _completer = new Completer(); | 594 _completer = new Completer(); |
596 _subscription = stream.listen( | 595 _subscription = stream.listen( |
597 (data) { | 596 (data) { |
598 _controller.add(data); | 597 _controller.add(data); |
599 }, | 598 }, |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2313 | 2312 |
2314 | 2313 |
2315 class _RedirectInfo implements RedirectInfo { | 2314 class _RedirectInfo implements RedirectInfo { |
2316 const _RedirectInfo(int this.statusCode, | 2315 const _RedirectInfo(int this.statusCode, |
2317 String this.method, | 2316 String this.method, |
2318 Uri this.location); | 2317 Uri this.location); |
2319 final int statusCode; | 2318 final int statusCode; |
2320 final String method; | 2319 final String method; |
2321 final Uri location; | 2320 final Uri location; |
2322 } | 2321 } |
OLD | NEW |