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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 Future<T> addStream(Stream<List<int>> stream) { | 467 Future<T> addStream(Stream<List<int>> stream) { |
468 return _dataSink.addStream(stream); | 468 return _dataSink.addStream(stream); |
469 } | 469 } |
470 | 470 |
471 Future close() { | 471 Future close() { |
472 return _dataSink.close(); | 472 return _dataSink.close(); |
473 } | 473 } |
474 | 474 |
475 Future<T> get done => _dataSink.done; | 475 Future<T> get done => _dataSink.done; |
476 | 476 |
477 Future _writeHeaders({drainRequest: true}) { | 477 Future _writeHeaders({bool drainRequest: true}) { |
478 if (_headersWritten) return new Future.value(); | 478 if (_headersWritten) return new Future.value(); |
479 _headersWritten = true; | 479 _headersWritten = true; |
480 headers._synchronize(); // Be sure the 'chunked' option is updated. | 480 headers._synchronize(); // Be sure the 'chunked' option is updated. |
481 _dataSink.encoding = encoding; | 481 _dataSink.encoding = encoding; |
482 bool isServerSide = this is _HttpResponse; | 482 bool isServerSide = this is _HttpResponse; |
483 if (isServerSide) { | 483 if (isServerSide) { |
484 var response = this; | 484 var response = this; |
485 if (headers.chunkedTransferEncoding) { | 485 if (headers.chunkedTransferEncoding) { |
486 List acceptEncodings = | 486 List acceptEncodings = |
487 response._httpRequest.headers[HttpHeaders.ACCEPT_ENCODING]; | 487 response._httpRequest.headers[HttpHeaders.ACCEPT_ENCODING]; |
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 final Uri location; | 2470 final Uri location; |
2471 } | 2471 } |
2472 | 2472 |
2473 String _getHttpVersion() { | 2473 String _getHttpVersion() { |
2474 var version = Platform.version; | 2474 var version = Platform.version; |
2475 // Only include major and minor version numbers. | 2475 // Only include major and minor version numbers. |
2476 int index = version.indexOf('.', version.indexOf('.') + 1); | 2476 int index = version.indexOf('.', version.indexOf('.') + 1); |
2477 version = version.substring(0, index); | 2477 version = version.substring(0, index); |
2478 return 'Dart/$version (dart:io)'; | 2478 return 'Dart/$version (dart:io)'; |
2479 } | 2479 } |
OLD | NEW |