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

URI specifies and handles brackets around IPv6 address inconsistently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta3
    • generic
    • generic
    • Verified

      From: Mark Reinhold <###@###.###>
      To: ###@###.###
      cc: ###@###.###, ###@###.###
      Date: Wed, 19 Sep 2001 18:01:56 -0700

      > Date: Wed, 19 Sep 2001 17:41:07 -0700 (PDT)
      > From: ###@###.###

      > The "however" clause is meant to say: althougth the standard is defined in
      > rfc2732 (with "[]"), we also accept IP addresses without the ([]) so that the
      > user's application won't break if they do something like "new
      > URL/URI(inetAddress.getHostAddress())".
      >
      > So, it's put there to allow URL/URI constructors more lenient.

      Okay, that seems reasonable, but one problem is that it doesn't work with the
      URI(String) constructor. If I try

          new URI("foo://::192.9.5.5/bar/baz")

      then I get a URI with a non-server authority, i.e., it doesn't parse the IPv6
      address as such.

      This does seem to work with the other constructors, e.g.,

          new URI("foo", "::192.9.5.5", "/bar/baz", null)

      returns the URI foo://[::192.9.5.5]/bar/baz, as expected. On the other hand,

          new URI("foo", "[::192.9.5.5]", "/bar/baz", null)

      throws a URISyntaxException with the message

          Malformed IPv6 address at index 7: foo://[[::192.9.5.5]]/bar/baz

      so this case looks like a bug.

      So it looks like the specs of the URI constructors that take component
      arguments should say that the brackets are optional, but the spec of the
      URI(String) constructor should say that they're required. There's also a small
      bug in how brackets are handled by the multi-argument constructors.


      Date: Wed, 19 Sep 2001 18:11:27 -0700 (PDT)
      From: Yingxian Wang <###@###.###>
      Subject: Re: URI spec question: IPv6 addresses
      To: ###@###.###, ###@###.###
      Cc: ###@###.###, ###@###.###

      We only allow IP addresses without [] passing in as a host in the componentized
      constructors, because that's where people will most likly just pass in an IP
      address. but where these is a context that combines both host and port, we would
      stick to RFC2732, because in that case, we may not be able to distinguish host
      from port, and we think people should provide correct forms when they generate
      host and port together in one context.

            mr Mark Reinhold
            mr Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: