Author: toad
Date: 2009-01-07 22:05:15 +0000 (Wed, 07 Jan 2009)
New Revision: 24974

Modified:
   trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
   trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
   trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
   trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
   trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
   trunk/freenet/src/freenet/clients/http/Toadlet.java
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
Log:
Fix links in Location: redirects


Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2009-01-07 
21:59:42 UTC (rev 24973)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2009-01-07 
22:05:15 UTC (rev 24974)
@@ -121,7 +121,7 @@
                String pass = request.getPartAsString("formPassword", 32);
                if((pass == null) || !pass.equals(core.formPassword)) {
                        MultiValueTable<String,String> headers = new 
MultiValueTable<String,String>();
-                       headers.put("Location", "/config/");
+                       headers.put("Location", container.fixLink("/config/"));
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        return;
                }
@@ -231,7 +231,7 @@
                                return;
                        } else {
                                MultiValueTable<String, String> headers = new 
MultiValueTable<String, String>();
-                               headers.put("Location", 
"/config/?mode="+MODE_SECURITY_LEVELS);
+                               headers.put("Location", 
container.fixLink("/config/?mode="+MODE_SECURITY_LEVELS));
                                ctx.sendReplyHeaders(302, "Found", headers, 
null, 0);
                                return;
                        }

Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java      
2009-01-07 21:59:42 UTC (rev 24973)
+++ trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java      
2009-01-07 22:05:15 UTC (rev 24974)
@@ -500,7 +500,7 @@
                String pass = request.getPartAsString("formPassword", 32);
                if((pass == null) || !pass.equals(core.formPassword)) {
                        MultiValueTable<String, String> headers = new 
MultiValueTable<String, String>();
-                       headers.put("Location", defaultRedirectLocation());
+                       headers.put("Location", 
container.fixLink(defaultRedirectLocation()));
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        if(logMINOR) Logger.minor(this, "No password ("+pass+" 
should be "+core.formPassword+ ')');
                        return;
@@ -608,7 +608,7 @@
                        }
                        
                        MultiValueTable<String, String> headers = new 
MultiValueTable<String, String>();
-                       headers.put("Location", defaultRedirectLocation());
+                       headers.put("Location", 
container.fixLink(defaultRedirectLocation()));
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        return;
                } else handleAltPost(uri, request, ctx, logMINOR);

Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2009-01-07 21:59:42 UTC (rev 24973)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2009-01-07 22:05:15 UTC (rev 24974)
@@ -214,9 +214,6 @@
                                }
                        }
                        redirectHere(ctx);
-                       MultiValueTable<String, String> headers = new 
MultiValueTable<String, String>();
-                       headers.put("Location", container.fixLink("/friends/"));
-                       ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        return;
                } else if (request.isPartSet("doAction") && 
request.getPartAsString("action",25).equals("set_burst_only")) {
                        //int hashcode = 
Integer.decode(request.getParam("node")).intValue();

Modified: trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java    2009-01-07 
21:59:42 UTC (rev 24973)
+++ trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java    2009-01-07 
22:05:15 UTC (rev 24974)
@@ -86,7 +86,7 @@
                        return;
                }
                MultiValueTable<String, String> headers = new 
MultiValueTable<String, String>();
-               headers.put("Location", "/friends/");
+               headers.put("Location", container.fixLink("/friends/"));
                ctx.sendReplyHeaders(302, "Found", headers, null, 0);
        }
 
@@ -122,7 +122,7 @@
                String pass = request.getPartAsString("formPassword", 32);
                if ((pass == null) || !pass.equals(core.formPassword)) {
                        MultiValueTable<String, String> headers = new 
MultiValueTable<String, String>();
-                       headers.put("Location", "/send_n2ntm/");
+                       headers.put("Location", 
container.fixLink("/send_n2ntm/"));
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        return;
                }
@@ -229,7 +229,7 @@
                        return;
                }
                MultiValueTable<String, String> headers = new 
MultiValueTable<String, String>();
-               headers.put("Location", "/friends/");
+               headers.put("Location", container.fixLink("/friends/"));
                ctx.sendReplyHeaders(302, "Found", headers, null, 0);
        }
 

Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java   2009-01-07 
21:59:42 UTC (rev 24973)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java   2009-01-07 
22:05:15 UTC (rev 24974)
@@ -52,7 +52,7 @@
 
                String pass = request.getPartAsString("formPassword", 32);
                if((pass == null) || !pass.equals(core.formPassword)) {
-                       headers.put("Location", "/plugins/");
+                       headers.put("Location", container.fixLink("/plugins/"));
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        return;
                }
@@ -124,7 +124,7 @@
                                String pluginName = null;
                                pluginName = 
request.getPartAsString("plugin-name", 40);
                                pm.startPluginOfficial(pluginName, true);
-                               headers.put("Location", ".");
+                               headers.put("Location", 
container.fixLink("/plugins/"));
                                ctx.sendReplyHeaders(302, "Found", headers, 
null, 0);
                                return;
                        }
@@ -136,7 +136,7 @@
                                        pm.startPluginFile(pluginName, true);
                                else
                                        pm.startPluginURL(pluginName, true);
-                               headers.put("Location", ".");
+                               headers.put("Location", 
container.fixLink("/plugins/"));
                                ctx.sendReplyHeaders(302, "Found", headers, 
null, 0);
                                return;
                        }
@@ -144,19 +144,19 @@
                                String pluginName = null;
                                pluginName = 
request.getPartAsString("plugin-uri", 300);
                                pm.startPluginFreenet(pluginName, true);
-                               headers.put("Location", ".");
+                               headers.put("Location", 
container.fixLink("/plugins/"));
                                ctx.sendReplyHeaders(302, "Found", headers, 
null, 0);
                                return;
                        }
                        if (request.isPartSet("dismiss-user-alert")) {
                                int userAlertHashCode = 
request.getIntPart("disable", -1);
                                core.alerts.dismissAlert(userAlertHashCode);
-                               headers.put("Location", ".");
+                               headers.put("Location", 
container.fixLink("/plugins/"));
                                ctx.sendReplyHeaders(302, "Found", headers, 
null, 0);
                                return;
                        }
                        if (request.isPartSet("cancel")){
-                               headers.put("Location", "/plugins/");
+                               headers.put("Location", 
container.fixLink("/plugins/"));
                                ctx.sendReplyHeaders(302, "Found", headers, 
null, 0);
                                return;
                        }
@@ -231,13 +231,13 @@
                                        // FIXME
                                        pm.startPluginAuto(fn, true);
 
-                                       headers.put("Location", ".");
+                                       headers.put("Location", 
container.fixLink("/plugins/"));
                                        ctx.sendReplyHeaders(302, "Found", 
headers, null, 0);
                                }
                                return;
                        }else {
                                // Ignore
-                               headers.put("Location", ".");
+                               headers.put("Location", 
container.fixLink("/plugins/"));
                                ctx.sendReplyHeaders(302, "Found", headers, 
null, 0);
                        }
 

Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2009-01-07 21:59:42 UTC 
(rev 24973)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2009-01-07 22:05:15 UTC 
(rev 24974)
@@ -171,7 +171,7 @@
        
        static void writePermanentRedirect(ToadletContext ctx, String msg, 
String location) throws ToadletContextClosedException, IOException {
                MultiValueTable<String, String> mvt = new 
MultiValueTable<String, String>();
-               mvt.put("Location", location);
+               mvt.put("Location", ctx.getContainer().fixLink(location));
                if(msg == null) msg = "";
                else msg = HTMLEncoder.encode(msg);
                String redirDoc =
@@ -190,7 +190,7 @@
        
        protected void writeTemporaryRedirect(ToadletContext ctx, String msg, 
String location) throws ToadletContextClosedException, IOException {
                MultiValueTable<String, String> mvt = new 
MultiValueTable<String, String>();
-               mvt.put("Location", location);
+               mvt.put("Location", container.fixLink(location));
                if(msg == null) msg = "";
                else msg = HTMLEncoder.encode(msg);
                String redirDoc =

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2009-01-07 
21:59:42 UTC (rev 24973)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2009-01-07 
22:05:15 UTC (rev 24974)
@@ -126,7 +126,7 @@
             if ((request.getPartAsString("Go", 32).length() > 0)) {
                 url = 
request.getPartAsString(GenericReadFilterCallback.magicHTTPEscapeString, 
MAX_URL_LENGTH);
             }
-            headers.put("Location", url == null ? "/" : url);
+            headers.put("Location", container.fixLink(url == null ? "/" : 
url));
             ctx.sendReplyHeaders(302, "Found", headers, null, 0);
         } else if (request.getPartAsString("update", 32).length() > 0) {
             HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(l10n("nodeUpdateConfirmTitle"), ctx);

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to