Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      We found that currently xFire are not fully compatible with IPV6, after looking at the sources we found that xFire open a file with a given IP address as the file name when the '.' Character is replaced with "_" in order to be a legal file name.
      IPV6 uses additional characters that need to be replaced to "_" as well.

      The fix:
      From XFire lib - commons-codec-1.3.jar
      Class:

      org.apache.commons.codec.net.URLCodec

      Method:
      public static final byte[] decodeUrl(byte[] bytes) throws DecoderException

      Description of changes:

      Skip replacing characters between [] if exist.

      Modified code:

      public static final byte[] decodeUrl(byte[] bytes) throws DecoderException {

      if (bytes == null)

      { return null; }

      String url = new String(bytes);

      ByteArrayOutputStream buffer = new ByteArrayOutputStream();

      int i = 0;

      int indOpenIpv6 = url.indexOf('[');

      int indCloseIpv6 = url.indexOf(']');

      if (indOpenIpv6 == 0 && indCloseIpv6 != -1) {

      for (; i <= indCloseIpv6; i++)

      { int b = bytes[i]; buffer.write(b); }

      }

      //---------------------------------------

      for (; i < bytes.length; i++) {

      int b = bytes[i];

      if (b == '+')

      { buffer.write(' '); }

      else if (b == '%') {

      try {

      int u = Character.digit((char) bytes[++i], 16);

      int l = Character.digit((char) bytes[++i], 16);

      if (u == -1 || l == -1)

      { throw new DecoderException("Invalid URL encoding"); }

      buffer.write((char) ((u << 4) + l));

      } catch (ArrayIndexOutOfBoundsException e)

      { throw new DecoderException("Invalid URL encoding"); }

      } else

      { buffer.write(b); }

      }

      url = new String(buffer.toByteArray());

      return buffer.toByteArray();

      }

      I didn't know how to publish (suggest ) a fix that's why I post it here.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Dan Diephouse
            Reporter:
            Dror Bar-Gil
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 1 hour
              1h
              Remaining:
              Remaining Estimate - 1 hour
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified