| 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 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; | 7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; |
| 8 | 8 |
| 9 typedef void _BytesConsumer(List<int> bytes); | 9 typedef void _BytesConsumer(List<int> bytes); |
| 10 | 10 |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } else { | 874 } else { |
| 875 _consume(chunk.sublist(start, end - start)); | 875 _consume(chunk.sublist(start, end - start)); |
| 876 } | 876 } |
| 877 } | 877 } |
| 878 | 878 |
| 879 void close() {} | 879 void close() {} |
| 880 } | 880 } |
| 881 | 881 |
| 882 // The _HttpOutgoing handles all of the following: | 882 // The _HttpOutgoing handles all of the following: |
| 883 // - Buffering | 883 // - Buffering |
| 884 // - GZip compressionm | 884 // - GZip compression |
| 885 // - Content-Length validation. | 885 // - Content-Length validation. |
| 886 // - Errors. | 886 // - Errors. |
| 887 // | 887 // |
| 888 // Most notable is the GZip compression, that uses a double-buffering system, | 888 // Most notable is the GZip compression, that uses a double-buffering system, |
| 889 // one before gzip (_gzipBuffer) and one after (_buffer). | 889 // one before gzip (_gzipBuffer) and one after (_buffer). |
| 890 class _HttpOutgoing implements StreamConsumer<List<int>> { | 890 class _HttpOutgoing implements StreamConsumer<List<int>> { |
| 891 static const List<int> _footerAndChunk0Length = const [ | 891 static const List<int> _footerAndChunk0Length = const [ |
| 892 _CharCode.CR, | 892 _CharCode.CR, |
| 893 _CharCode.LF, | 893 _CharCode.LF, |
| 894 0x30, | 894 0x30, |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 ..contentLength = 0; | 1848 ..contentLength = 0; |
| 1849 }); | 1849 }); |
| 1850 } | 1850 } |
| 1851 | 1851 |
| 1852 // Return a live connection to the idle pool. | 1852 // Return a live connection to the idle pool. |
| 1853 void _returnConnection(_HttpClientConnection connection) { | 1853 void _returnConnection(_HttpClientConnection connection) { |
| 1854 _connectionTargets[connection.key].returnConnection(connection); | 1854 _connectionTargets[connection.key].returnConnection(connection); |
| 1855 _connectionsChanged(); | 1855 _connectionsChanged(); |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 // Remove a closed connnection from the active set. | 1858 // Remove a closed connection from the active set. |
| 1859 void _connectionClosed(_HttpClientConnection connection) { | 1859 void _connectionClosed(_HttpClientConnection connection) { |
| 1860 connection.stopTimer(); | 1860 connection.stopTimer(); |
| 1861 var connectionTarget = _connectionTargets[connection.key]; | 1861 var connectionTarget = _connectionTargets[connection.key]; |
| 1862 if (connectionTarget != null) { | 1862 if (connectionTarget != null) { |
| 1863 connectionTarget.connectionClosed(connection); | 1863 connectionTarget.connectionClosed(connection); |
| 1864 if (connectionTarget.isEmpty) { | 1864 if (connectionTarget.isEmpty) { |
| 1865 _connectionTargets.remove(connection.key); | 1865 _connectionTargets.remove(connection.key); |
| 1866 } | 1866 } |
| 1867 _connectionsChanged(); | 1867 _connectionsChanged(); |
| 1868 } | 1868 } |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2839 const _RedirectInfo(this.statusCode, this.method, this.location); | 2839 const _RedirectInfo(this.statusCode, this.method, this.location); |
| 2840 } | 2840 } |
| 2841 | 2841 |
| 2842 String _getHttpVersion() { | 2842 String _getHttpVersion() { |
| 2843 var version = Platform.version; | 2843 var version = Platform.version; |
| 2844 // Only include major and minor version numbers. | 2844 // Only include major and minor version numbers. |
| 2845 int index = version.indexOf('.', version.indexOf('.') + 1); | 2845 int index = version.indexOf('.', version.indexOf('.') + 1); |
| 2846 version = version.substring(0, index); | 2846 version = version.substring(0, index); |
| 2847 return 'Dart/$version (dart:io)'; | 2847 return 'Dart/$version (dart:io)'; |
| 2848 } | 2848 } |
| OLD | NEW |