This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[4.1] Patch: FYI: fix another http protocol buglet
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 20 Jan 2006 15:08:00 -0700
- Subject: [4.1] Patch: FYI: fix another http protocol buglet
- Reply-to: tromey at redhat dot com
I'm checking this in on the 4.1 branch.
This fixes another http protocol bug that I found by chance while
fixing the last one. Thanks to Chris Burdess for the patch.
Tom
Index: ChangeLog
from Chris Burdess <dog@gnu.org>
* gnu/java/net/protocol/http/HTTPURLConnection.java: Don't follow
redirects on 304.
Index: gnu/java/net/protocol/http/HTTPURLConnection.java
===================================================================
--- gnu/java/net/protocol/http/HTTPURLConnection.java (revision 110042)
+++ gnu/java/net/protocol/http/HTTPURLConnection.java (working copy)
@@ -254,7 +254,7 @@
}
}
- if (response.getCodeClass() == 3 && getInstanceFollowRedirects())
+ if (isRedirect(response) && getInstanceFollowRedirects())
{
// Read the response body, if there is one. If the
// redirect points us back at the same server, we will use
@@ -360,6 +360,12 @@
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.
*/