Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4458085

Redirects Limited to 5

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.3.1_03
    • 1.3.0, 1.3.1_01
    • core-libs
    • 03
    • generic, sparc
    • generic, solaris_7



        Name: boT120536 Date: 05/13/2001


        $ java -version
        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
        Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

        Thanks Bret for his response. But when I look at the HTTP1.1 spec (RFC 2616)
        Section 10.3, it said "Note: previous versions of this specification
        recommended a maximum of five redirections...."

        that means the latest version of Http1.1 spec does not have such restriction,
        right?

        ----------------------------------------------------------------------
        Bret O'Neal <###@###.###> wrote:


        Hi Sam Cheung,

        Server redirected to many times is due to the Http 1.1 Spec.
        It is spec'd to stop @ 5.

        See the following search of our bug and forum Db
        http://search.java.sun.com/Search/java?qt=+%2BServer+%2Bredirected+%2Btoo+%
        2Bmany+%2Btimes&col=nforum&col=obug&rf=0


        (Please make sure all white space is out of the address before you paste it in
        to your browser.)


        Regards,
        Bret
        ----------------- Original Bug Report-------------------

        category : java
        subcategory : classes_net
        release : 1.3
        type : bug
        synopsis : java API throws ProtocolException when accessing
        site "http://expediamaps.com"
        description : $ java -version
        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
        Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

        1. run the sample program below:

        import java.net.*;
        import java.io.*;

        public class TestURL {
        public static void main(String[] args) {
        try {
        URL url = new URL("http://www.expediamaps.com/");
        url.set(
        BufferedReader in = new BufferedReader(
        new InputStreamReader(
        url.openStream()));

        String inputLine;

        while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);

        in.close();
        } catch (Exception e) {
        System.out.println (e.toString());
        System.out.println (e.getMessage());
        e.printStackTrace();
        }

        }
        }

        2. Here is the Exception thrown by Java net API. This program works if I use
        another site (e.g. www.yahoo.com )
        java.net.ProtocolException: Server redirected too many times (5)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream
        (HttpURLConnection.java:552)
        at java.net.URL.openStream(URL.java:798)
        at TestURL.main(TestURL.java:20)
        java.net.ProtocolException: Server redirected too many times (5)
        Server redirected too many times (5)
        Server redirected too many times (5)

        My question is why Java Net API thrown that exception. I can access the site
        from my browser. And what is the work-around for that problem.
        workaround :
        suggested_val :
        cust_name : Sam Cheung
        cust_email : ###@###.###, ###@###.###
        jdcid : sy_cheung
        keyword : webbug
        company : Novarra
        hardware : x86
        OSversion : windows_2000
        bugtraqID : 0
        dateCreated : 2001-04-30 14:47:35.4
        dateEvaluated : 2001-05-06 15:56:21.524
        (Review ID: 123910)
        ======================================================================


        *** ###@###.### 10/05/2001 ***
        Attached is a sample test case (Test1.java.Z) which exhibits this problem
        using jdk 1.3.1_01 & Solaris 7. This sample case works fine using jdk 1.4beta2.
        This sample test case exhibits the same "Server redirected ..." error.

              michaelm Michael McMahon
              bonealsunw Bret O'neal (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: