xFire and IPV6
--------------
Key: XFIRE-1132
URL: http://jira.codehaus.org/browse/XFIRE-1132
Project: XFire
Issue Type: Bug
Reporter: Dror Bar-Gil
Assignee: Dan Diephouse
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email