diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-01-04 09:36:08 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-01-04 09:36:08 -0800 |
commit | a31b4292d856f2fc4ca5ecc5fa9493774fd8f7be (patch) | |
tree | 24746f47edb723dbca4f0b1624c63a4bc1052f74 /src/github | |
parent | 8236aba9db41fd3c4929527244a9b2aff33098dc (diff) | |
download | dsub-a31b4292d856f2fc4ca5ecc5fa9493774fd8f7be.tar.gz dsub-a31b4292d856f2fc4ca5ecc5fa9493774fd8f7be.tar.bz2 dsub-a31b4292d856f2fc4ca5ecc5fa9493774fd8f7be.zip |
#239 Allow GZip encoding where supported
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/service/RESTMusicService.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index 6d55cbd3..951a182d 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -98,6 +98,7 @@ import github.daneren2005.dsub.util.FileUtil; import github.daneren2005.dsub.util.ProgressListener; import github.daneren2005.dsub.util.Util; import java.io.*; +import java.util.zip.GZIPInputStream; /** * @author Sindre Mehus @@ -1269,6 +1270,10 @@ public class RESTMusicService implements MusicService { } InputStream in = entity.getContent(); + Header contentEncoding = entity.getContentEncoding(); + if (contentEncoding != null && contentEncoding.getValue().equalsIgnoreCase("gzip")) { + in = new GZIPInputStream(in); + } return new InputStreamReader(in, Constants.UTF_8); } @@ -1356,6 +1361,7 @@ public class RESTMusicService implements MusicService { request.addHeader(header); } } + request.addHeader("Accept-Encoding", "gzip"); // Set credentials to get through apache proxies that require authentication. int instance = prefs.getInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, 1); |