Handle more cases of HTTP redirect

This commit is contained in:
Andreas Schildbach 2013-10-23 11:44:37 +02:00
parent 3fa357d8ca
commit f28109c5aa

View file

@ -202,6 +202,10 @@ public final class ParserUtils
{ {
throw new NotFoundException(url); throw new NotFoundException(url);
} }
else if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_MOVED_TEMP)
{
throw new UnexpectedRedirectException(url, connection.getURL());
}
else else
{ {
final String message = "got response: " + responseCode + " " + connection.getResponseMessage(); final String message = "got response: " + responseCode + " " + connection.getResponseMessage();
@ -357,6 +361,10 @@ public final class ParserUtils
{ {
throw new NotFoundException(url); throw new NotFoundException(url);
} }
else if (responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_MOVED_TEMP)
{
throw new UnexpectedRedirectException(url, connection.getURL());
}
else else
{ {
final String message = "got response: " + responseCode + " " + connection.getResponseMessage(); final String message = "got response: " + responseCode + " " + connection.getResponseMessage();