Author: toad
Date: 2009-01-07 22:17:45 +0000 (Wed, 07 Jan 2009)
New Revision: 24975

Modified:
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
Log:
Make the fetch-a-key form initially a POST form (it redirects to a GET form, 
just as it did when it was a GET).


Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2009-01-07 
22:05:15 UTC (rev 24974)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2009-01-07 
22:17:45 UTC (rev 24975)
@@ -103,6 +103,7 @@
                String type = req.isPartSet("type") ? 
req.getPartAsString("type", 30) : null;
                boolean forceDownload = req.isPartSet("forcedownload");
                String force = req.isPartSet("force") ? 
req.getPartAsString("force", 30) : null;
+               String key = req.isPartSet("key") ? req.getPartAsString("key", 
1024) : null;
                
                String pass = req.getPartAsString("formPassword", 32);
                if ((pass.length() == 0) || !pass.equals(core.formPassword)) {
@@ -112,10 +113,17 @@
                        return;
                }
 
-               if(maxSize != null || type != null || (!forceDownload) || force 
!= null) {
+               if(maxSize != null || type != null || (!forceDownload) || force 
!= null || key != null) {
                        StringBuffer sb = new StringBuffer();
                        boolean first = true;
+                       if(key != null) {
+                               if(!first) sb.append('&');
+                               sb.append("key=");
+                               sb.append(URLEncoder.encode(key, false));
+                               first = false;
+                       }
                        if(maxSize != null) {
+                               if(!first) sb.append('&');
                                sb.append("max-size=");
                                sb.append(URLEncoder.encode(maxSize, false));
                                first = false;

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2009-01-07 
22:05:15 UTC (rev 24974)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2009-01-07 
22:17:45 UTC (rev 24975)
@@ -592,7 +592,7 @@
         HTMLNode fetchKeyBox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal", 
l10n("fetchKeyLabel")));
         HTMLNode fetchKeyContent = 
ctx.getPageMaker().getContentNode(fetchKeyBox);
         fetchKeyContent.addAttribute("id", "keyfetchbox");
-        HTMLNode fetchKeyForm = fetchKeyContent.addChild("form", new 
String[]{"action", "method"}, new String[]{"/", "get"}).addChild("div");
+        HTMLNode fetchKeyForm = ctx.addFormChild(fetchKeyContent, "/", 
"fetchKeyForm").addChild("div");
         fetchKeyForm.addChild("#", l10n("keyRequestLabel") + ' ');
         fetchKeyForm.addChild("input", new String[]{"type", "size", "name"}, 
new String[]{"text", "80", "key"});
         fetchKeyForm.addChild("input", new String[]{"type", "value"}, new 
String[]{"submit", l10n("fetch")});

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

Reply via email to