| 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 | 7 class _HttpIncoming |
| 8 extends Stream<List<int>> implements StreamSink<List<int>> { | 8 extends Stream<List<int>> implements StreamSink<List<int>> { |
| 9 final int _transferLength; | 9 final int _transferLength; |
| 10 final Completer _dataCompleter = new Completer(); | 10 final Completer _dataCompleter = new Completer(); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 if (_ignoreBody) return new Future.immediate(this); | 339 if (_ignoreBody) return new Future.immediate(this); |
| 340 if (_chunked) { | 340 if (_chunked) { |
| 341 // Transform when chunked. | 341 // Transform when chunked. |
| 342 stream = stream.transform(new _ChunkedTransformer()); | 342 stream = stream.transform(new _ChunkedTransformer()); |
| 343 } | 343 } |
| 344 return super.consume(stream).then((_) => this); | 344 return super.consume(stream).then((_) => this); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void add(List<int> data) { | 347 void add(List<int> data) { |
| 348 _writeHeaders(); | 348 _writeHeaders(); |
| 349 if (_ignoreBody) return; | 349 if (_ignoreBody || data.length == 0) return; |
| 350 if (_chunked) { | 350 if (_chunked) { |
| 351 _ChunkedTransformer._addChunk(data, super.add); | 351 _ChunkedTransformer._addChunk(data, super.add); |
| 352 } else { | 352 } else { |
| 353 super.add(data); | 353 super.add(data); |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 void close() { | 357 void close() { |
| 358 if (!_headersWritten && !_ignoreBody && headers.chunkedTransferEncoding) { | 358 if (!_headersWritten && !_ignoreBody && headers.chunkedTransferEncoding) { |
| 359 // If no body was written, _ignoreBody is false (it's not a HEAD | 359 // If no body was written, _ignoreBody is false (it's not a HEAD |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 | 1601 |
| 1602 | 1602 |
| 1603 class _RedirectInfo implements RedirectInfo { | 1603 class _RedirectInfo implements RedirectInfo { |
| 1604 const _RedirectInfo(int this.statusCode, | 1604 const _RedirectInfo(int this.statusCode, |
| 1605 String this.method, | 1605 String this.method, |
| 1606 Uri this.location); | 1606 Uri this.location); |
| 1607 final int statusCode; | 1607 final int statusCode; |
| 1608 final String method; | 1608 final String method; |
| 1609 final Uri location; | 1609 final Uri location; |
| 1610 } | 1610 } |
| OLD | NEW |