Jetty
  1. Jetty
  2. JETTY-603

jetty unable to parse IPV6 addressing

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0.0pre3, 6.1.12rc1
    • Component/s: HTTP
    • Labels:
      None
    • Environment:
      linux, basically this is not related to environment.
    • Number of attachments :
      1

      Description

      hi,
      when we send a http request to a jetty server through a proxy with SSL enabled, it sends the full address in the Http command like this.
      GET https://[2001:db8:10:110::a75:2a3]:28188/hello HTTP/1.1

      Jetty fails to parse this IPV6 address format and throws an exception when we try to get different parts of the command like URI, server port etc.

      [2008-05-22 03:31:10.657] ERROR 000000000000 GLOBAL_SCOPE The servlet caught a throwable (of type class java.lang.NumberFormatException) and is erroring out: db8:10:110::a75:2a3]:28188
      [2008-05-22 03:31:10.657] ERROR 000000000000 GLOBAL_SCOPE [1211441470657] db8:10:110::a75:2a3]:28188
      [2008-05-22 03:31:10.66] ERRORDTL 000000000000 GLOBAL_SCOPE [1211441470657]java.lang.NumberFormatException: db8:10:110::a75:2a3]:28188
      at org.mortbay.util.TypeUtil.parseInt(TypeUtil.java:380)
      at org.mortbay.jetty.HttpURI.getPort(HttpURI.java:381)
      at org.mortbay.jetty.Request.getServerName(Request.java:986)
      at org.mortbay.jetty.Request.getServerPort(Request.java:1042)

      i believe the fix needs to be done in HttpURI.java.

        Activity

        Hide
        Greg Wilkins added a comment -

        indeed the : in the address would through off the parsing.

        do you know if the [ ] around the ipv6 is part of a standard? ie should we be looking for [ and then ] before looking for a : ?
        If you could point to an RFC for this format, that would be of great assistance and we could get this fixed ASAP.

        Show
        Greg Wilkins added a comment - indeed the : in the address would through off the parsing. do you know if the [ ] around the ipv6 is part of a standard? ie should we be looking for [ and then ] before looking for a : ? If you could point to an RFC for this format, that would be of great assistance and we could get this fixed ASAP.
        Hide
        Greg Wilkins added a comment -
        Show
        Greg Wilkins added a comment - OK I found http://www.ietf.org/rfc/rfc2732.txt
        Hide
        Athena Yao added a comment -

        I've attached a diff that detects an ipv6 address in the host (found within brackets), but it doesn't do any strict checking for the format of the IPv6 address. Is it worth the additional effort to do so?

        Show
        Athena Yao added a comment - I've attached a diff that detects an ipv6 address in the host (found within brackets), but it doesn't do any strict checking for the format of the IPv6 address. Is it worth the additional effort to do so?
        Hide
        Greg Wilkins added a comment -

        thanks athena

        Show
        Greg Wilkins added a comment - thanks athena
        Hide
        Shawn Jiang added a comment -

        I'm using 7.0.0.0.M3 with IPV6 address in browser but failed.

        1, start jetty with "java -jar startup.jar"

        2, netstat -na

        I only can see the ipv4 listener there:

        TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING

        3, use http://[myIPV6address]:8080/ to access the jetty instance. No lucky, can't access it at all.

        Show
        Shawn Jiang added a comment - I'm using 7.0.0.0.M3 with IPV6 address in browser but failed. 1, start jetty with "java -jar startup.jar" 2, netstat -na I only can see the ipv4 listener there: TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 3, use http://[myIPV6address]:8080/ to access the jetty instance. No lucky, can't access it at all.
        Hide
        Shawn Jiang added a comment -

        Forgot to list my envrionment:

        7.0.0.0.M3 + IPV6 enabled windows XP + SUN JDK 1.6

        BTW, tomcat 6.1.8 does not have this problem.

        Show
        Shawn Jiang added a comment - Forgot to list my envrionment: 7.0.0.0.M3 + IPV6 enabled windows XP + SUN JDK 1.6 BTW, tomcat 6.1.8 does not have this problem.

          People

          • Assignee:
            Athena Yao
            Reporter:
            Gaurav Abbi
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: