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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 540 } |
541 | 541 |
542 void _onListen() { | 542 void _onListen() { |
543 if (!_controller.hasListener && _subscription != null) { | 543 if (!_controller.hasListener && _subscription != null) { |
544 _subscription.cancel(); | 544 _subscription.cancel(); |
545 } | 545 } |
546 } | 546 } |
547 | 547 |
548 _ensureController() { | 548 _ensureController() { |
549 if (_controller != null) return; | 549 if (_controller != null) return; |
550 _controller = new StreamController(onPauseStateChange: _onPause, | 550 _controller = new StreamController(onPause: _onPause, |
551 onSubscriptionStateChange: _onListen); | 551 onResume: _onPause, |
| 552 onListen: _onListen, |
| 553 onCancel: _onListen); |
552 _outbound._addStream(_controller.stream) | 554 _outbound._addStream(_controller.stream) |
553 .then((_) { | 555 .then((_) { |
554 _done(); | 556 _done(); |
555 _closeCompleter.complete(_outbound); | 557 _closeCompleter.complete(_outbound); |
556 }, | 558 }, |
557 onError: (error) { | 559 onError: (error) { |
558 if (!_done(error)) { | 560 if (!_done(error)) { |
559 _closeCompleter.completeError(error); | 561 _closeCompleter.completeError(error); |
560 } | 562 } |
561 }); | 563 }); |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 | 1988 |
1987 | 1989 |
1988 class _RedirectInfo implements RedirectInfo { | 1990 class _RedirectInfo implements RedirectInfo { |
1989 const _RedirectInfo(int this.statusCode, | 1991 const _RedirectInfo(int this.statusCode, |
1990 String this.method, | 1992 String this.method, |
1991 Uri this.location); | 1993 Uri this.location); |
1992 final int statusCode; | 1994 final int statusCode; |
1993 final String method; | 1995 final String method; |
1994 final Uri location; | 1996 final Uri location; |
1995 } | 1997 } |
OLD | NEW |