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

jwebserver tool prints invalid URL in case of IPv6 address binding

XMLWordPrintable

    • b23
    • generic
    • generic
    • Verified

      ADDITIONAL SYSTEM INFORMATION :
      Tested on win 10, java "Java(TM) SE Runtime Environment (build 22+36-2370)", I believe this is not OS specific issue.

      A DESCRIPTION OF THE PROBLEM :
      jwebserver.exe tool prints invalid URL in case local "::1" IPv6 is used for binding.

      ---
      Command:
      jwebserver.exe -b ::1
      or
      jwebserver.exe -b 0:0:0:0:0:0:0:1
      Incorrect URL printed:
      http://0:0:0:0:0:0:0:1:8000/
      ---

      According to RFC 2732 it should be:
      http://[0:0:0:0:0:0:0:1]:8000/
      OR just
      http://[::1]:8000/
      =================================

      The issue is the first URL is not recognized by browser (when pasted to address bar) as a valid URL which triggers to "search" action (i.e. Chrome).

      ====
      full output:
      ====


      c:\Program Files\Java\jdk-22\bin>java --version
      java 22 2024-03-19
      Java(TM) SE Runtime Environment (build 22+36-2370)
      Java HotSpot(TM) 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)

      c:\Program Files\Java\jdk-22\bin>jwebserver.exe -b ::1
      Serving c:\Program Files\Java\jdk-22\bin and subdirectories on 0:0:0:0:0:0:0:1 port 8000
      URL http://0:0:0:0:0:0:0:1:8000/

      c:\Program Files\Java\jdk-22\bin>jwebserver.exe -b 0:0:0:0:0:0:0:1
      Serving c:\Program Files\Java\jdk-22\bin and subdirectories on 0:0:0:0:0:0:0:1 port 8000
      URL http://0:0:0:0:0:0:0:1:8000/

            jpai Jaikiran Pai
            pnarayanaswa Praveen Narayanaswamy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: