Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: sdk/lib/io/http_impl.dart

Issue 12661003: Fix empty zlib deflate and early close of responses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/data_transformer.dart ('k') | tests/standalone/io/http_compression_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index ce3c63a00fb9ae4072888ba92dab8f836d06cd48..49071c0e0bb05519516d9b0807c4fac7c65dd24a 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -405,7 +405,9 @@ abstract class _HttpOutboundMessage<T> implements IOSink {
}
void close() {
- if (!_headersWritten && !_ignoreBody && headers.chunkedTransferEncoding) {
+ // TODO(ajohnsen): Currently, contentLength, chunkedTransferEncoding and
+ // persistentConnection is not guaranteed to be in sync.
+ if (!_headersWritten && !_ignoreBody && headers.contentLength == -1) {
// If no body was written, _ignoreBody is false (it's not a HEAD
// request) and the content-length is unspecified, set contentLength to 0.
headers.chunkedTransferEncoding = false;
@@ -433,7 +435,9 @@ abstract class _HttpOutboundMessage<T> implements IOSink {
response._httpRequest.headers[HttpHeaders.ACCEPT_ENCODING];
List contentEncoding = headers[HttpHeaders.CONTENT_ENCODING];
if (acceptEncodings != null &&
- acceptEncodings.any((encoding) => encoding.toLowerCase() == "gzip") &&
+ acceptEncodings
+ .expand((list) => list.split(","))
+ .any((encoding) => encoding.trim().toLowerCase() == "gzip") &&
contentEncoding == null) {
headers.set(HttpHeaders.CONTENT_ENCODING, "gzip");
asGZip = true;
@@ -805,7 +809,7 @@ class _ChunkedTransformer extends StreamEventTransformer<List<int>, List<int>> {
}
void handleDone(EventSink<List<int>> sink) {
- handleData([], sink);
+ handleData(const [], sink);
sink.close();
}
« no previous file with comments | « sdk/lib/io/data_transformer.dart ('k') | tests/standalone/io/http_compression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698