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

setRequestProperty(key,value) when redirection is turned off

XMLWordPrintable

    • 005
    • x86
    • windows_nt
    • Verified


        This bug is similar to bug 4113495 but the customer is using
        setRequestProperty instead and only occurs when redirection
        is turned off.

        CUSTOMER DESCRIPTION
        The bug in my case appears only when the redirection is turned off
        and the redirection is handled by opening a new connection by using
        the location header.
        I have set the request property by using setRequestProperty(key,value)
        and the getRequestProperty(key) returns the values I have set.
        But these values are not being sent to the web server but the default
        values are being sent instead.
        Here are the values sent to the web server.

        ALL_RAW Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Host:
        test-pc User-Agent: Java1.2.2

        Client Side:

        HttpURLConnection.setFollowRedirects(false);
        URL u = new URL("http://my-store.inktomi.com/default.asp"); //This url is
        inside firewall and cannot be accesed.

        URLConnection uc = (HttpURLConnection) u.openConnection();
        uc.setRequestProperty ("Cookie",
        "ASPSESSIONIDGQGGGHHV=KKILIEHBGPHDKOHDMGOLGHFB");
        uc.setRequestProperty ("User-Agent", "Mozilla/4.0 (compatible; MSIE 4.01;
        Windows NT)");
        // readFromURLConnection(); // Get the streams and read the document
        String location = uc.getHeaderField("Location");
        uc.close();

        URL ru = new URL(location);

        URLConnection ruc = (HttpURLConnection) ru.openConnection();
        ruc.setRequestProperty ("Cookie",
        "ASPSESSIONIDGQGGGHHV=KKILIEHBGPHDKOHDMGOLGHFB");
        ruc.setRequestProperty ("User-Agent", "Mozilla/4.0 (compatible; MSIE 4.01;
        Windows NT)");
        // readFromURLConnection(); // Get the streams and read the document
        // The webser since it never gets the cookeis returns an error document as
        the session is not traced
        ruc.close();

        Server Side trace:

        Original Request:
        Accept: application/vnd.ms-excel, application/msword,
        application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg,
        image/pjpeg, */* Accept-Language: en-us Connection: close User-Agent:
        Mozilla/4.0 (compatible; MSIE 4.01; Windows NT) Pragma: Cookie:
        ASPSESSIONIDGQGGGHHV=MKILIEHBPGKPIMNJDDCPIKLI Authorization:
        If-Modified-Since: Content-Length: 0 Content-Type: accept-charset:
        accept-encoding: gzip, deflate

        Redirected Request:
        ALL_RAW Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Host:
        test-pc User-Agent: Java1.2.2

              scfitch Stephen Fitch
              atongschsunw Albert Tong-schmidt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: