From: <asa...@us...> - 2015-10-20 09:18:17
|
Revision: 11427 http://sourceforge.net/p/htmlunit/code/11427 Author: asashour Date: 2015-10-20 09:18:15 +0000 (Tue, 20 Oct 2015) Log Message: ----------- Fix build Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2015-10-20 08:20:00 UTC (rev 11426) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2015-10-20 09:18:15 UTC (rev 11427) @@ -19,7 +19,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.EOFException; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -53,7 +52,6 @@ import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; import org.apache.http.auth.AuthScope; import org.apache.http.auth.Credentials; import org.apache.http.client.CredentialsProvider; @@ -670,19 +668,13 @@ */ protected DownloadedContent downloadResponseBody(final HttpResponse httpResponse) throws IOException { final HttpEntity httpEntity = httpResponse.getEntity(); - if (httpEntity == null || isRedirect(httpResponse.getStatusLine().getStatusCode())) { + if (httpEntity == null) { return new DownloadedContent.InMemory(new byte[] {}); } return downloadContent(httpEntity.getContent(), webClient_.getOptions().getMaxInMemory()); } - private boolean isRedirect(final int status) { - return ((status >= HttpStatus.SC_MOVED_PERMANENTLY && status <= HttpStatus.SC_SEE_OTHER) - || status == HttpStatus.SC_TEMPORARY_REDIRECT) - && webClient_.getOptions().isRedirectEnabled(); - } - /** * Reads the content of the stream and saves it in memory or on the file system. * @param is the stream to read @@ -717,10 +709,9 @@ LOG.warn("Connection was closed while reading from stream.", e); return new DownloadedContent.InMemory(bos.toByteArray()); } - catch (final EOFException e) { + catch (final IOException e) { // this might happen with broken gzip content - // see com.gargoylesoftware.htmlunit.HttpWebConnection2Test.brokenGzip() - LOG.warn("EndOfFile while reading from stream.", e); + LOG.warn("Exception while reading from stream.", e); return new DownloadedContent.InMemory(bos.toByteArray()); } finally { |