Merge pull request #100 from tschulte/issue-95
download control files using gzip content encoding
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import javax.swing.JApplet;
|
import javax.swing.JApplet;
|
||||||
|
|
||||||
@@ -1653,7 +1654,12 @@ public class Application
|
|||||||
// about it; turning off caches is not a performance concern, because when Getdown asks
|
// about it; turning off caches is not a performance concern, because when Getdown asks
|
||||||
// to download a file, it expects it to come over the wire, not from a cache
|
// to download a file, it expects it to come over the wire, not from a cache
|
||||||
uconn.setUseCaches(false);
|
uconn.setUseCaches(false);
|
||||||
|
uconn.setRequestProperty("Accept-Encoding", "gzip");
|
||||||
fin = uconn.getInputStream();
|
fin = uconn.getInputStream();
|
||||||
|
String encoding = uconn.getContentEncoding();
|
||||||
|
if ("gzip".equalsIgnoreCase(encoding)) {
|
||||||
|
fin = new GZIPInputStream(fin);
|
||||||
|
}
|
||||||
fout = new FileOutputStream(target);
|
fout = new FileOutputStream(target);
|
||||||
StreamUtil.copy(fin, fout);
|
StreamUtil.copy(fin, fout);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user