Author: toad
Date: 2006-11-15 18:41:11 +0000 (Wed, 15 Nov 2006)
New Revision: 10935

Modified:
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
   trunk/freenet/src/freenet/keys/FreenetURI.java
   trunk/freenet/src/freenet/node/updater/NodeUpdater.java
Log:
Updater fixes:
- Show update confirm page even if no formpassword (there isn't one from the 
update button). Means that the update button will work again.
- Correct the update and revocation URIs: If they have a trailing / (they 
will), remove it. Means that auto-update will work again.
- Better logging.

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2006-11-15 
18:07:09 UTC (rev 10934)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2006-11-15 
18:41:11 UTC (rev 10935)
@@ -98,10 +98,6 @@
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        return;
                }else if (request.getPartAsString("update", 32).length() > 0) {
-                       if(noPassword) {
-                               redirectToRoot(ctx);
-                               return;
-                       }
                        HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Update");
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", "Node 
Update"));

Modified: trunk/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- trunk/freenet/src/freenet/keys/FreenetURI.java      2006-11-15 18:07:09 UTC 
(rev 10934)
+++ trunk/freenet/src/freenet/keys/FreenetURI.java      2006-11-15 18:41:11 UTC 
(rev 10935)
@@ -377,9 +377,13 @@
        }

        public String getMetaString() {
-               return ((metaStr == null) || (metaStr.length == 0) ? null : 
metaStr[0]);
+               return ((metaStr == null) || (metaStr.length == 0)) ? null : 
metaStr[0];
        }

+       public String lastMetaString() {
+               return ((metaStr == null ) || (metaStr.length == 0)) ? null : 
metaStr[metaStr.length-1]; 
+       }
+       
        public String[] getAllMetaStrings() {
                return metaStr;
        }

Modified: trunk/freenet/src/freenet/node/updater/NodeUpdater.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdater.java     2006-11-15 
18:07:09 UTC (rev 10934)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdater.java     2006-11-15 
18:41:11 UTC (rev 10935)
@@ -52,7 +52,7 @@
        private final FreenetURI URI;
        private final FreenetURI revocationURI;
        private final Ticker ticker;
-       private final NodeClientCore core;
+       public final NodeClientCore core;
        private final Node node;

        private final int currentVersion;
@@ -74,6 +74,16 @@

        public NodeUpdater(Node n, boolean isAutoUpdateAllowed, FreenetURI URI, 
FreenetURI revocationURI) {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+               if(URI.lastMetaString() != null && 
URI.lastMetaString().length() == 0) {
+                       // FIXME remove this hack, put in because of bad default
+                       System.err.println("Correcting auto-update URI: 
Removing extra /");
+                       URI = URI.popMetaString();
+               }
+               if(revocationURI.lastMetaString() != null && 
revocationURI.lastMetaString().length() == 0) {
+                       // FIXME remove this hack, put in because of bad default
+                       System.err.println("Correcting auto-update revocation 
URI: Removing extra /");
+                       revocationURI = revocationURI.popMetaString();
+               }
                this.URI = URI;
                URI.setSuggestedEdition(Version.buildNumber()+1);
                this.revocationURI = revocationURI;
@@ -225,7 +235,6 @@
                        System.err.println("Searching for revocation key");
                        this.queueFetchRevocation(100);
                        while(revocationDNFCounter < 
NodeUpdater.REVOCATION_DNF_MIN) {
-                               System.err.println("Revocation counter: 
"+revocationDNFCounter);
                                if(this.hasBeenBlown) {
                                        Logger.error(this, "The revocation key 
has been found on the network : blocking auto-update");
                                        return;
@@ -484,6 +493,7 @@
                                maybeUpdate();
                        } else {
                                Logger.error(this, "Canceling fetch : "+ 
e.getMessage());
+                               System.err.println("Unexpected error fetching 
update: "+e.getMessage());
                        }
                }else{
                        Logger.minor(this, "Revocation fetch failed: "+e);


Reply via email to