diff --git a/src/Common/org/lobobrowser/util/io/IORoutines.java b/src/Common/org/lobobrowser/util/io/IORoutines.java index 2b4e60e9..4c37e578 100644 --- a/src/Common/org/lobobrowser/util/io/IORoutines.java +++ b/src/Common/org/lobobrowser/util/io/IORoutines.java @@ -37,6 +37,7 @@ import java.util.Collection; import java.util.stream.Collectors; import java.util.zip.GZIPInputStream; +import java.util.zip.InflaterInputStream; /** * @author J. H. S. @@ -197,18 +198,32 @@ public static java.util.List loadStrings(final File file) throws IOExcep public static InputStream getDecodedStream(final URLConnection connection) throws IOException { final InputStream cis = connection.getInputStream(); - final InputStream is = "gzip".equals(connection.getContentEncoding()) ? new GZIPInputStream(cis) : cis; + final InputStream is; + if ("gzip".equals(connection.getContentEncoding())) { + is = new GZIPInputStream(cis); + } else if ("deflate".equals(connection.getContentEncoding())) { + is = new InflaterInputStream(cis); + } else { + is = cis; + } return is; } public static InputStream getDecodedErrorStream(final HttpURLConnection connection) throws IOException { final InputStream cis = connection.getErrorStream(); + final InputStream is; if (cis != null) { - final InputStream is = "gzip".equals(connection.getContentEncoding()) ? new GZIPInputStream(cis) : cis; - return is; + if ("gzip".equals(connection.getContentEncoding())) { + is = new GZIPInputStream(cis); + } else if ("deflate".equals(connection.getContentEncoding())) { + is = new InflaterInputStream(cis); + } else { + is = cis; + } } else { - return null; + is = null; } + return is; } } diff --git a/src/Platform_Core/org/lobobrowser/request/RequestEngine.java b/src/Platform_Core/org/lobobrowser/request/RequestEngine.java index e8ac1859..1d103a66 100644 --- a/src/Platform_Core/org/lobobrowser/request/RequestEngine.java +++ b/src/Platform_Core/org/lobobrowser/request/RequestEngine.java @@ -311,7 +311,7 @@ private static void addRequestProperties(final URLConnection connection, final C final URL lastRequestURL, final RequestHandler rhandler) throws ProtocolException { final UserAgent userAgent = request.getUserAgent(); connection.addRequestProperty("User-Agent", userAgent.toString()); - connection.addRequestProperty("Accept-Encoding", "gzip"); + connection.addRequestProperty("Accept-Encoding", "gzip, deflate"); // TODO: Harshad: Commenting out X-Java-Version. Check if required. // connection.addRequestProperty("X-Java-Version", userAgent.getJavaVersion());