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

HttpURLConnection tosses cookies after redirect

XMLWordPrintable

    • b01
    • generic
    • solaris_2.4
    • Not verified

      When HttpURLConnection gets a "Location:" header it redirects
      to that URL. It also discards all the original http headers
      before the redirect. This results in the loss of any
      "Set-Cookie" headers and the loss of any cookies.

      Setting a cookie in a redirect works in Netscape.

      This is causing problems for Sherlock/AnswerBook2 which
      uses this method to select display languages for docs.
      I have heard third hand that Oracle may use this also.

      This is reproducible with hotjava1.0m and JDK1.1.1E (fcs).
      HotJava wont return the cookie since it never sees the
      Set-Cookie header since its tosses after the redirect.

      Attached is a CGI script which does:

      Set-Cookie: COOKIE_REDIRECT=http://leconte.eng/~roberto
      Location: http://leconte.eng/~roberto

      You'll probably want to change the location that is
      redirected to.

            djbrown David Brown (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: