summaryrefslogtreecommitdiff
path: root/gnu/java/net/protocol/http/HTTPURLConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/java/net/protocol/http/HTTPURLConnection.java')
-rw-r--r--gnu/java/net/protocol/http/HTTPURLConnection.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/gnu/java/net/protocol/http/HTTPURLConnection.java b/gnu/java/net/protocol/http/HTTPURLConnection.java
index d5da7d61a..f33e70da3 100644
--- a/gnu/java/net/protocol/http/HTTPURLConnection.java
+++ b/gnu/java/net/protocol/http/HTTPURLConnection.java
@@ -254,7 +254,7 @@ public class HTTPURLConnection
}
}
- if (response.getCodeClass() == 3 && getInstanceFollowRedirects())
+ if (isRedirect(response) && getInstanceFollowRedirects())
{
// Follow redirect
String location = response.getHeader("Location");
@@ -344,6 +344,12 @@ public class HTTPURLConnection
connected = true;
}
+ private static boolean isRedirect(Response response)
+ {
+ int sc = response.getCode();
+ return (sc != 304 && (sc / 100) == 3);
+ }
+
/**
* Returns a connection, from the pool if necessary.
*/