Author: toad
Date: 2006-03-31 01:37:04 +0000 (Fri, 31 Mar 2006)
New Revision: 8383

Modified:
   trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
   trunk/freenet/src/freenet/node/Version.java
Log:
602: If it looks like a URI with the preceeding slash missing... it probably 
is. This makes edition 9 of the testnet index work.

Modified: 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
===================================================================
--- 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java    
    2006-03-31 01:02:24 UTC (rev 8382)
+++ 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java    
    2006-03-31 01:37:04 UTC (rev 8383)
@@ -48,15 +48,22 @@
                        bookmark_desc = HTMLEncoder.encode(bookmark_desc);

                        return 
"/?newbookmark="+bookmark_key+"&desc="+bookmark_desc;
-               } else if(path.startsWith("/")) {
+               } else if(path.startsWith("/") || path.indexOf('@') != -1) {
                        // Try to make it into a FreenetURI
                        try {
-                               FreenetURI furi = new 
FreenetURI(path.substring(1));
+                               String p = path;
+                               while(p.startsWith("/")) p = p.substring(1);
+                               FreenetURI furi = new FreenetURI(p);
                                return processURI(furi, uri, overrideType);
                        } catch (MalformedURLException e) {
                                // Obviously not a Freenet URI!
-                                       
                        }
+               }
+               if(path.startsWith("/")) {
+                       // Still here. It's an absolute URI and *NOT* a freenet 
URI.
+                       // Kill it.
+                       Logger.normal(this, "Unrecognized URI, dropped: "+uri);
+                       return null;
                } else {
                        // Relative URI
                        // FIXME resolve it
@@ -64,8 +71,6 @@
                        // This is okay because we don't allow forms.
                        return finishProcess(req, overrideType, path);
                }
-               Logger.normal(this, "Unrecognized URI, dropped: "+uri);
-               return null;
        }

        private String finishProcess(HTTPRequest req, String overrideType, 
String path) {

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-03-31 01:02:24 UTC (rev 
8382)
+++ trunk/freenet/src/freenet/node/Version.java 2006-03-31 01:37:04 UTC (rev 
8383)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 601;
+       private static final int buildNumber = 602;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 591;


Reply via email to