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

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

Issue 13934002: Add support for client-side GZip compression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « no previous file | 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 6fc339a8616b7c18e608e1ddf9a2977c73918f88..a0c1730d7ab182f96adaff4d3674eb398c3e7cd7 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -234,10 +234,14 @@ class _HttpClientResponse
{void onError(AsyncError error),
void onDone(),
bool unsubscribeOnError}) {
- return _incoming.listen(onData,
- onError: onError,
- onDone: onDone,
- unsubscribeOnError: unsubscribeOnError);
+ var stream = _incoming;
+ if (headers.value(HttpHeaders.CONTENT_ENCODING) == "gzip") {
+ stream = stream.transform(new ZLibInflater());
+ }
+ return stream.listen(onData,
+ onError: onError,
+ onDone: onDone,
+ unsubscribeOnError: unsubscribeOnError);
}
Future<Socket> detachSocket() {
@@ -971,6 +975,7 @@ class _HttpClientConnection {
this);
request.headers.host = uri.domain;
request.headers.port = port;
+ request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip");
if (uri.userInfo != null && !uri.userInfo.isEmpty) {
// If the URL contains user information use that for basic
// authorization
« no previous file with comments | « no previous file | tests/standalone/io/http_compression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698