jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
XFire
  • XFire
  • XFIRE-1132

xFire and IPV6

  • Log In
  • Views
    • XML
    • Word
    • Printable

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

  • All
  • Comments
  • Work Log
  • History
  • Activity
No changes have yet been made on this issue.

People

  • Assignee:
    Dan Diephouse
    Reporter:
    Dror Bar-Gil
Vote (1)
Watch (1)

Dates

  • Created:
    18/Sep/08 9:01 AM
    Updated:
    18/Sep/08 9:01 AM

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.