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

Incorrect handling of IPv6 addresses in Socket(Proxy.HTTP)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 13
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b13
    • Verification:
      Verified

      Description


      jshell> byte[] bytes = new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}
      bytes ==> byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }

      jshell> var proxyAddress = new InetSocketAddress(InetAddress.getByAddress(bytes), 8888)
      proxyAddress ==> /0:0:0:0:0:0:0:1:8888

      jshell> var endpointAddress = new InetSocketAddress(InetAddress.getByAddress(bytes), 9999)
      endpointAddress ==> /0:0:0:0:0:0:0:1:9999

      jshell> var proxy = new Proxy(Proxy.Type.HTTP, proxyAddress)
      proxy ==> HTTP @ /0:0:0:0:0:0:0:1:8888

      jshell> var socket = new Socket(proxy)
      socket ==> Socket[unconnected]

      jshell> socket.connect(endpointAddress)
      | Exception java.net.MalformedURLException: Error at index 1 in: "0:0:0:0:0:0:1:9999"
      | at URL.<init> (URL.java:684)
      | at URL.<init> (URL.java:546)
      | at URL.<init> (URL.java:493)
      | at HttpConnectSocketImpl.doTunnel (HttpConnectSocketImpl.java:163)
      | at HttpConnectSocketImpl$2.run (HttpConnectSocketImpl.java:151)
      | at HttpConnectSocketImpl$2.run (HttpConnectSocketImpl.java:149)
      | at AccessController.doPrivileged (AccessController.java:553)
      | at HttpConnectSocketImpl.privilegedDoTunnel (HttpConnectSocketImpl.java:148)
      | at HttpConnectSocketImpl.connect (HttpConnectSocketImpl.java:111)
      | at Socket.connect (Socket.java:589)
      | at Socket.connect (Socket.java:538)
      | at (#6:1)
      | Caused by: java.lang.NumberFormatException: Error at index 1 in: "0:0:0:0:0:0:1:9999"
      | at NumberFormatException.forCharSequence (NumberFormatException.java:84)
      | at Integer.parseInt (Integer.java:741)
      | at URLStreamHandler.parseURL (URLStreamHandler.java:223)
      | at URL.<init> (URL.java:679)
      | ...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              chegar Chris Hegarty
              Reporter:
              chegar Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: