From: <asa...@us...> - 2015-10-20 08:20:02
|
Revision: 11426 http://sourceforge.net/p/htmlunit/code/11426 Author: asashour Date: 2015-10-20 08:20:00 +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 07:33:29 UTC (rev 11425) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2015-10-20 08:20:00 UTC (rev 11426) @@ -670,15 +670,19 @@ */ protected DownloadedContent downloadResponseBody(final HttpResponse httpResponse) throws IOException { final HttpEntity httpEntity = httpResponse.getEntity(); - final int status = httpResponse.getStatusLine().getStatusCode(); - if (httpEntity == null || ((status <= HttpStatus.SC_SEE_OTHER || status == HttpStatus.SC_TEMPORARY_REDIRECT) - && webClient_.getOptions().isRedirectEnabled())) { + if (httpEntity == null || isRedirect(httpResponse.getStatusLine().getStatusCode())) { 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 |