Author: j16sdiz
Date: 2009-03-23 11:40:59 +0000 (Mon, 23 Mar 2009)
New Revision: 26141

Modified:
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
Log:
Preseve ?max-size on redirect

?max-size= was preserved only in some redirect, not all of them.
This patch use getLink() uniformly to fix this issue.

Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2009-03-23 
08:13:54 UTC (rev 26140)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2009-03-23 
11:40:59 UTC (rev 26141)
@@ -375,13 +375,9 @@
                                }
                                
                                if(logMINOR) Logger.minor(this, "Redirecting to 
FreenetURI: "+newURI);
-                               String type = httprequest.getParam("type");
-                               String location;
-                               if ((type != null) && (type.length() > 0)) {
-                                       location =  "/"+newURI + "?type=" + 
type;
-                               } else {
-                                       location =  "/"+newURI;
-                               }
+                               String requestedMimeType = 
httprequest.getParam("type");
+                               long maxSize = 
httprequest.getLongParam("max-size", MAX_LENGTH);
+                               String location = getLink(newURI, 
requestedMimeType, maxSize, httprequest.getParam("force", null), 
httprequest.isParameterSet("forcedownload"));
                                writeTemporaryRedirect(ctx, null, location);
                                return;
                        }
@@ -499,7 +495,8 @@
                        if(Logger.shouldLog(Logger.MINOR, this))
                                Logger.minor(this, "Failed to fetch "+uri+" : 
"+e);
                        if(e.newURI != null) {
-                               Toadlet.writePermanentRedirect(ctx, msg, '/' 
+e.newURI.toASCIIString() + override);
+                               Toadlet.writePermanentRedirect(ctx, msg,
+                                       getLink(e.newURI, requestedMimeType, 
maxSize, httprequest.getParam("force", null), 
httprequest.isParameterSet("forcedownload")));
                        } else if(e.mode == FetchException.TOO_BIG) {
                                HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(l10n("fileInformationTitle"), ctx);
                                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

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

Reply via email to