Chromium Code Reviews| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 } | 421 } |
| 422 | 422 |
| 423 void _writeHeaders() { | 423 void _writeHeaders() { |
| 424 if (_headersWritten) return; | 424 if (_headersWritten) return; |
| 425 _headersWritten = true; | 425 _headersWritten = true; |
| 426 _ioSink.encoding = Encoding.ASCII; | 426 _ioSink.encoding = Encoding.ASCII; |
| 427 headers._synchronize(); // Be sure the 'chunked' option is updated. | 427 headers._synchronize(); // Be sure the 'chunked' option is updated. |
| 428 bool asGZip = false; | 428 bool asGZip = false; |
| 429 bool isServerSide = this is _HttpResponse; | 429 bool isServerSide = this is _HttpResponse; |
| 430 if (isServerSide && headers.chunkedTransferEncoding) { | 430 if (isServerSide && headers.chunkedTransferEncoding) { |
| 431 _HttpResponse response = this as _HttpResponse; | |
|
Søren Gjesse
2013/03/12 13:22:10
You don't need "as _HttpResponse" here.
Anders Johnsen
2013/03/12 13:30:01
The editor told me I did - see new CL :)
| |
| 431 List acceptEncodings = | 432 List acceptEncodings = |
| 432 _httpRequest.headers[HttpHeaders.ACCEPT_ENCODING]; | 433 response._httpRequest.headers[HttpHeaders.ACCEPT_ENCODING]; |
| 433 List contentEncoding = headers[HttpHeaders.CONTENT_ENCODING]; | 434 List contentEncoding = headers[HttpHeaders.CONTENT_ENCODING]; |
| 434 if (acceptEncodings != null && | 435 if (acceptEncodings != null && |
| 435 acceptEncodings.any((encoding) => encoding.toLowerCase() == "gzip") && | 436 acceptEncodings.any((encoding) => encoding.toLowerCase() == "gzip") && |
| 436 contentEncoding == null) { | 437 contentEncoding == null) { |
| 437 headers.set(HttpHeaders.CONTENT_ENCODING, "gzip"); | 438 headers.set(HttpHeaders.CONTENT_ENCODING, "gzip"); |
| 438 asGZip = true; | 439 asGZip = true; |
| 439 } | 440 } |
| 440 } | 441 } |
| 441 _writeHeader(); | 442 _writeHeader(); |
| 442 _ioSink = new IOSink(new _HttpOutboundConsumer(_ioSink, _consume, asGZip)); | 443 _ioSink = new IOSink(new _HttpOutboundConsumer(_ioSink, _consume, asGZip)); |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1709 | 1710 |
| 1710 | 1711 |
| 1711 class _RedirectInfo implements RedirectInfo { | 1712 class _RedirectInfo implements RedirectInfo { |
| 1712 const _RedirectInfo(int this.statusCode, | 1713 const _RedirectInfo(int this.statusCode, |
| 1713 String this.method, | 1714 String this.method, |
| 1714 Uri this.location); | 1715 Uri this.location); |
| 1715 final int statusCode; | 1716 final int statusCode; |
| 1716 final String method; | 1717 final String method; |
| 1717 final Uri location; | 1718 final Uri location; |
| 1718 } | 1719 } |
| OLD | NEW |