Author: toad
Date: 2006-02-01 00:19:07 +0000 (Wed, 01 Feb 2006)
New Revision: 7981
Modified:
trunk/freenet/src/freenet/keys/FreenetURI.java
trunk/freenet/src/freenet/node/Version.java
Log:
424:
Don't url encode/decode parts of URIs until somebody gives me a good reason.
Means it's not possible to create a URI containing slashes which are not broken
out into sub-manifests.
But also means that it is possible to use wide-chars in URIs.
Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java 2006-01-31 23:57:32 UTC
(rev 7980)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java 2006-02-01 00:19:07 UTC
(rev 7981)
@@ -150,9 +150,9 @@
int slash2;
Vector sv = new Vector();
while ((slash2 = URI.lastIndexOf("/")) != -1) {
- String s = urlDecode(URI.substring(slash2 +
"/".length()));
+ String s = URI.substring(slash2 + "/".length());
if (s != null)
- sv.addElement(urlDecode(s));
+ sv.addElement(s);
URI = URI.substring(0, slash2);
}
if("SSK".equals(keyType)) {
@@ -326,34 +326,6 @@
extra);
}
- protected static String urlDecode(String s) {
- StringBuffer b = new StringBuffer();
- for (int i = 0; i < s.length(); i++) {
- if (s.charAt(i) == '+')
- b.append(' ');
- else if (s.charAt(i) == '%') {
- int n = Integer.parseInt(s.substring(i + 1, i +
3), 16);
- b.append((char) n);
- i += 2;
- } else
- b.append(s.charAt(i));
- }
- return b.toString();
- }
-
- protected static String urlEncode(String s) {
- StringBuffer b = new StringBuffer();
- for (int i = 0; i < s.length(); i++) {
- if (s.charAt(i) == ' ')
- b.append('+');
- else if (s.charAt(i) > 128 || s.charAt(i) < 44) {
-
b.append('%').append(Integer.toString(s.charAt(i), 16));
- } else
- b.append(s.charAt(i));
- }
- return b.toString();
- }
-
public String toString() {
return toString(true);
}
@@ -379,10 +351,10 @@
}
if (docName != null)
- b.append(urlEncode(docName));
+ b.append(docName);
if (metaStr != null) {
for (int i = 0; i < metaStr.length; i++) {
- b.append("/").append(urlEncode(metaStr[i]));
+ b.append("/").append(metaStr[i]);
}
}
return b.toString();
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-01-31 23:57:32 UTC (rev
7980)
+++ trunk/freenet/src/freenet/node/Version.java 2006-02-01 00:19:07 UTC (rev
7981)
@@ -20,7 +20,7 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- private static final int buildNumber = 423;
+ private static final int buildNumber = 424;
/** Oldest build of Fred we will talk to */
private static final int lastGoodBuild = 403;