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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 bool this._usingProxy, | 717 bool this._usingProxy, |
718 _HttpClient this._httpClient, | 718 _HttpClient this._httpClient, |
719 _HttpClientConnection this._httpClientConnection) | 719 _HttpClientConnection this._httpClientConnection) |
720 : super("1.1", outgoing) { | 720 : super("1.1", outgoing) { |
721 // GET and HEAD have 'content-length: 0' by default. | 721 // GET and HEAD have 'content-length: 0' by default. |
722 if (method == "GET" || method == "HEAD") { | 722 if (method == "GET" || method == "HEAD") { |
723 contentLength = 0; | 723 contentLength = 0; |
724 } | 724 } |
725 } | 725 } |
726 | 726 |
727 Future<HttpClientResponse> get response { | 727 Future<HttpClientResponse> get done { |
728 if (_response == null) { | 728 if (_response == null) { |
729 _response = Future.wait([_responseCompleter.future, super.done]) | 729 _response = Future.wait([_responseCompleter.future, super.done]) |
730 .then((list) => list[0]); | 730 .then((list) => list[0]); |
731 } | 731 } |
732 return _response; | 732 return _response; |
733 } | 733 } |
734 | 734 |
735 Future<HttpClientResponse> get done => response; | |
736 | |
737 Future<HttpClientResponse> consume(Stream<List<int>> stream) { | 735 Future<HttpClientResponse> consume(Stream<List<int>> stream) { |
738 super.consume(stream); | 736 super.consume(stream); |
739 return response; | 737 return done; |
740 } | 738 } |
741 | 739 |
742 Future<HttpClientResponse> close() { | 740 Future<HttpClientResponse> close() { |
743 super.close(); | 741 super.close(); |
744 return response; | 742 return done; |
745 } | 743 } |
746 | 744 |
747 int get maxRedirects => _maxRedirects; | 745 int get maxRedirects => _maxRedirects; |
748 void set maxRedirects(int maxRedirects) { | 746 void set maxRedirects(int maxRedirects) { |
749 if (_headersWritten) throw new StateError("Request already sent"); | 747 if (_headersWritten) throw new StateError("Request already sent"); |
750 _maxRedirects = maxRedirects; | 748 _maxRedirects = maxRedirects; |
751 } | 749 } |
752 | 750 |
753 bool get followRedirects => _followRedirects; | 751 bool get followRedirects => _followRedirects; |
754 void set followRedirects(bool followRedirects) { | 752 void set followRedirects(bool followRedirects) { |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 | 1818 |
1821 | 1819 |
1822 class _RedirectInfo implements RedirectInfo { | 1820 class _RedirectInfo implements RedirectInfo { |
1823 const _RedirectInfo(int this.statusCode, | 1821 const _RedirectInfo(int this.statusCode, |
1824 String this.method, | 1822 String this.method, |
1825 Uri this.location); | 1823 Uri this.location); |
1826 final int statusCode; | 1824 final int statusCode; |
1827 final String method; | 1825 final String method; |
1828 final Uri location; | 1826 final Uri location; |
1829 } | 1827 } |
OLD | NEW |