| 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 return _outbound._close().then((_) => _outbound); | 629 return _outbound._close().then((_) => _outbound); |
| 630 } | 630 } |
| 631 if (_controller == null) return closeOutbound(); | 631 if (_controller == null) return closeOutbound(); |
| 632 _controller.close(); | 632 _controller.close(); |
| 633 return _closeCompleter.future.then((_) => closeOutbound()); | 633 return _closeCompleter.future.then((_) => closeOutbound()); |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 class _BufferTransformer extends StreamEventTransformer<List<int>, List<int>> { | 638 class _BufferTransformer extends StreamEventTransformer<List<int>, List<int>> { |
| 639 const int MIN_CHUNK_SIZE = 4 * 1024; | 639 static const int MIN_CHUNK_SIZE = 4 * 1024; |
| 640 const int MAX_BUFFER_SIZE = 16 * 1024; | 640 static const int MAX_BUFFER_SIZE = 16 * 1024; |
| 641 | 641 |
| 642 final _BufferList _buffer = new _BufferList(); | 642 final _BufferList _buffer = new _BufferList(); |
| 643 | 643 |
| 644 void handleData(List<int> data, EventSink<List<int>> sink) { | 644 void handleData(List<int> data, EventSink<List<int>> sink) { |
| 645 // TODO(ajohnsen): Use timeout? | 645 // TODO(ajohnsen): Use timeout? |
| 646 if (data.length == 0) return; | 646 if (data.length == 0) return; |
| 647 if (data.length >= MIN_CHUNK_SIZE) { | 647 if (data.length >= MIN_CHUNK_SIZE) { |
| 648 flush(sink); | 648 flush(sink); |
| 649 sink.add(data); | 649 sink.add(data); |
| 650 } else { | 650 } else { |
| (...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 final Uri location; | 2381 final Uri location; |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 String _getHttpVersion() { | 2384 String _getHttpVersion() { |
| 2385 var version = Platform.version; | 2385 var version = Platform.version; |
| 2386 // Only include major and minor version numbers. | 2386 // Only include major and minor version numbers. |
| 2387 int index = version.indexOf('.', version.indexOf('.') + 1); | 2387 int index = version.indexOf('.', version.indexOf('.') + 1); |
| 2388 version = version.substring(0, index); | 2388 version = version.substring(0, index); |
| 2389 return 'Dart/$version (dart:io)'; | 2389 return 'Dart/$version (dart:io)'; |
| 2390 } | 2390 } |
| OLD | NEW |