Author: toad
Date: 2009-01-21 13:59:00 +0000 (Wed, 21 Jan 2009)
New Revision: 25183
Modified:
trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
trunk/freenet/src/freenet/clients/http/QueueToadlet.java
trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
trunk/freenet/src/freenet/clients/http/Toadlet.java
trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
Revert some more history cloaking commits. Minor conflict solved for 24958.
24968
24966
24965
24963
24959
24958 (with conflict)
Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java 2009-01-21
13:45:28 UTC (rev 25182)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java 2009-01-21
13:59:00 UTC (rev 25183)
@@ -322,9 +322,9 @@
HTMLNode infobox =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal",
l10n("possibilitiesTitle")));
HTMLNode content = ctx.getPageMaker().getContentNode(infobox);
- content.addChild("a", new String[]{"href", "title"}, new
String[]{ctx.fixLink("/config/"), l10n("shortTitle")},
l10n("returnToNodeConfig"));
+ content.addChild("a", new String[]{"href", "title"}, new
String[]{".", l10n("shortTitle")}, l10n("returnToNodeConfig"));
content.addChild("br");
- addHomepageLink(content, ctx);
+ addHomepageLink(content);
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-21
13:45:28 UTC (rev 25182)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-21
13:59:00 UTC (rev 25183)
@@ -159,27 +159,7 @@
}
}
- /**
- * @param context
- * @param data
- * @param bucketFactory
- * @param mimeType
- * @param requestedMimeType
- * @param forceString
- * @param forceDownload
- * @param basePath
- * @param key
- * @param uri If specified, use as base URI for filtering. Needed
because some pages are /u...@... and some
- * are /freenet:u...@...
- * @param extras
- * @param referrer
- * @param downloadLink
- * @param ctx
- * @param core
- * @throws ToadletContextClosedException
- * @throws IOException
- */
- public static void handleDownload(ToadletContext context, Bucket data,
BucketFactory bucketFactory, String mimeType, String requestedMimeType, String
forceString, boolean forceDownload, String basePath, FreenetURI key, URI uri,
String extras, String referrer, boolean downloadLink, ToadletContext ctx,
NodeClientCore core) throws ToadletContextClosedException, IOException {
+ public static void handleDownload(ToadletContext context, Bucket data,
BucketFactory bucketFactory, String mimeType, String requestedMimeType, String
forceString, boolean forceDownload, String basePath, FreenetURI key, String
extras, String referrer, boolean downloadLink, ToadletContext ctx,
NodeClientCore core) throws ToadletContextClosedException, IOException {
ToadletContainer container = context.getContainer();
if(Logger.shouldLog(Logger.MINOR, FProxyToadlet.class))
Logger.minor(FProxyToadlet.class,
"handleDownload(data.size="+data.size()+", mimeType="+mimeType+",
requestedMimeType="+requestedMimeType+", forceDownload="+forceDownload+",
basePath="+basePath+", key="+key);
@@ -204,7 +184,7 @@
Bucket toFree = null;
try {
if((!force) && (!forceDownload)) {
- FilterOutput fo = ContentFilter.filter(data,
bucketFactory, mimeType, uri == null ? key.toURI(basePath) : uri,
container.enableInlinePrefetch() ? prefetchHook : null, ctx);
+ FilterOutput fo = ContentFilter.filter(data,
bucketFactory, mimeType, key.toURI(basePath), container.enableInlinePrefetch()
? prefetchHook : null, ctx);
if(data != fo.data) toFree = fo.data;
data = fo.data;
mimeType = fo.type;
@@ -223,7 +203,7 @@
L10n.addL10nSubstitution(option,
"FProxyToadlet.openPossRSSAsPlainText", new String[] { "link", "/link", "bold",
"/bold" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?type=text/plain&force="+getForceValue(key,now)+extrasNoMime)+"\">",
+ "<a
href=\""+basePath+key.toString()+"?type=text/plain&force="+getForceValue(key,now)+extrasNoMime+"\">",
"</a>",
"<b>",
"</b>" });
@@ -231,7 +211,7 @@
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.openPossRSSForceDisk", new String[] { "link", "/link", "bold",
"/bold" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?forcedownload"+extras)+"\">",
+ "<a
href=\""+basePath+key.toString()+"?forcedownload"+extras+"\">",
"</a>",
"<b>",
"</b>" });
@@ -240,7 +220,7 @@
option =
optionList.addChild("li");
L10n.addL10nSubstitution(option, "FProxyToadlet.openRSSForce", new String[] {
"link", "/link", "bold", "/bold", "mime" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?force="+getForceValue(key,
now)+extras)+"\">",
+ "<a
href=\""+basePath+key.toString()+"?force="+getForceValue(key, now)+extras+"\">",
"</a>",
"<b>",
"</b>",
@@ -249,18 +229,18 @@
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.openRSSAsRSS", new String[] { "link", "/link", "bold", "/bold" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath + key.toString() +
"?type=application/xml+rss&force=" + getForceValue(key,
now)+extrasNoMime)+"\">",
+ "<a
href=\""+basePath + key.toString() + "?type=application/xml+rss&force=" +
getForceValue(key, now)+extrasNoMime+"\">",
"</a>",
"<b>",
"</b>" });
if(referrer != null) {
option =
optionList.addChild("li");
L10n.addL10nSubstitution(option, "FProxyToadlet.backToReferrer", new String[] {
"link", "/link" },
- new String[] {
"<a href=\""+HTMLEncoder.encode(ctx.fixLink(referrer))+"\">", "</a>" });
+ new String[] {
"<a href=\""+HTMLEncoder.encode(referrer)+"\">", "</a>" });
}
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToFProxy", new String[] { "link", "/link" },
- new String[] { "<a
href=\""+ctx.fixLink("/")+"\">", "</a>" });
+ new String[] { "<a
href=\"/\">", "</a>" });
byte[] pageBytes =
pageNode.generate().getBytes("UTF-8");
context.sendReplyHeaders(200, "OK", new
MultiValueTable<String, String>(), "text/html; charset=utf-8",
pageBytes.length);
@@ -298,27 +278,27 @@
if((mimeType.equals("application/x-freenet-index")) &&
(core.node.pluginManager.isPluginLoaded("plugins.ThawIndexBrowser.ThawIndexBrowser")))
{
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsThawIndex", new String[] { "link", "/link" }, new String[]
{ "<b><a href=\""+ctx.fixLink(basePath +
"plugins/plugins.ThawIndexBrowser.ThawIndexBrowser/?key=" + key.toString()) +
"\">", "</a></b>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsThawIndex", new String[] { "link", "/link" }, new String[]
{ "<b><a href=\""+basePath +
"plugins/plugins.ThawIndexBrowser.ThawIndexBrowser/?key=" + key.toString() +
"\">", "</a></b>" });
}
option = optionList.addChild("li");
// FIXME: is this safe? See bug #131
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsText", new String[] { "link", "/link" }, new String[] {
"<a
href=\""+ctx.fixLink(basePath+key.toString()+"?type=text/plain"+extrasNoMime)+"\">",
"</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsText", new String[] { "link", "/link" }, new String[] {
"<a href=\""+basePath+key.toString()+"?type=text/plain"+extrasNoMime+"\">",
"</a>" });
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openForceDisk", new String[] { "link", "/link" }, new String[] {
"<a
href=\""+ctx.fixLink(basePath+key.toString()+"?forcedownload"+extras)+"\">",
"</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openForceDisk", new String[] { "link", "/link" }, new String[] {
"<a href=\""+basePath+key.toString()+"?forcedownload"+extras+"\">", "</a>" });
if(!(mimeType.equals("application/octet-stream") ||
mimeType.equals("application/x-msdownload"))) {
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openForce", new String[] { "link", "/link", "mime" }, new
String[] { "<a href=\""+ctx.fixLink(basePath + key.toString() + "?force=" +
getForceValue(key, now)+extras)+"\">", "</a>", HTMLEncoder.encode(mimeType)});
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openForce", new String[] { "link", "/link", "mime" }, new
String[] { "<a href=\""+basePath + key.toString() + "?force=" +
getForceValue(key, now)+extras+"\">", "</a>", HTMLEncoder.encode(mimeType)});
}
if(referrer != null) {
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToReferrer", new String[] { "link", "/link" },
- new String[] { "<a
href=\""+HTMLEncoder.encode(ctx.fixLink(referrer))+"\">", "</a>" });
+ new String[] { "<a
href=\""+HTMLEncoder.encode(referrer)+"\">", "</a>" });
}
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToFProxy", new String[] { "link", "/link" },
- new String[] { "<a
href=\""+ctx.fixLink("/")+"\">", "</a>" });
+ new String[] { "<a href=\"/\">", "</a>"
});
if(ctx.isAllowedFullAccess() ||
!container.publicGatewayMode()) {
option = optionList.addChild("li");
HTMLNode optionForm = ctx.addFormChild(option,
"/queue/", "tooBigQueueForm");
@@ -494,7 +474,7 @@
errorContent.addChild("br");
errorContent.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBack")));
errorContent.addChild("br");
- addHomepageLink(errorContent, ctx);
+ addHomepageLink(errorContent);
this.writeHTMLReply(ctx, 400, l10n("invalidKeyTitle"),
pageNode.generate());
return;
@@ -521,7 +501,7 @@
String referer = sanitizeReferer(ctx);
- handleDownload(ctx, data, ctx.getBucketFactory(),
mimeType, requestedMimeType, httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload"), "/", key, uri, maxSize !=
MAX_LENGTH ? "&max-size="+SizeUtil.formatSizeWithoutSpace(maxSize) : "",
referer, true, ctx, core);
+ handleDownload(ctx, data, ctx.getBucketFactory(),
mimeType, requestedMimeType, httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload"), "/", key, maxSize != MAX_LENGTH ?
"&max-size="+SizeUtil.formatSizeWithoutSpace(maxSize) : "", referer, true, ctx,
core);
} catch (FetchException e) {
String msg = e.getMessage();
@@ -539,7 +519,7 @@
HTMLNode fileInformationList =
infoboxContent.addChild("ul");
HTMLNode option =
fileInformationList.addChild("li");
option.addChild("#", (l10n("filenameLabel") + '
'));
- option.addChild("a", "href", ctx.fixLink('/' +
key.toString()), getFilename(e, key, e.getExpectedMimeType()));
+ option.addChild("a", "href", '/' +
key.toString(), getFilename(e, key, e.getExpectedMimeType()));
String mime =
writeSizeAndMIME(fileInformationList, e);
@@ -564,7 +544,7 @@
optionForm.addChild("input", new
String[] { "type", "name", "value" }, new String[] { "submit", "download",
l10n("downloadInBackgroundToDisk") });
}
- optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { ctx.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
+ optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { "/",
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
option = optionList.addChild("li");
option.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBackToPrev")));
@@ -580,7 +560,7 @@
HTMLNode fileInformationList =
infoboxContent.addChild("ul");
HTMLNode option =
fileInformationList.addChild("li");
option.addChild("#", (l10n("filenameLabel") + '
'));
- option.addChild("a", "href", ctx.fixLink('/' +
key.toString()), getFilename(e, key, e.getExpectedMimeType()));
+ option.addChild("a", "href", '/' +
key.toString(), getFilename(e, key, e.getExpectedMimeType()));
String mime =
writeSizeAndMIME(fileInformationList, e);
infobox.addChild("div", "class",
"infobox-header", l10n("explanationTitle"));
@@ -600,7 +580,7 @@
if((e.mode == FetchException.NOT_IN_ARCHIVE) &&
(core.node.pluginManager.isPluginLoaded("plugins.KeyExplorer.KeyExplorer"))) {
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openWithKeyExplorer", new String[] { "link", "/link" }, new
String[] { "<a
href=\""+ctx.fixLink("/plugins/plugins.KeyExplorer.KeyExplorer/?key=" +
key.toString()) + "\">", "</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openWithKeyExplorer", new String[] { "link", "/link" }, new
String[] { "<a href=\"/plugins/plugins.KeyExplorer.KeyExplorer/?key=" +
key.toString() + "\">", "</a>" });
}
if(!e.isFatal() && (ctx.isAllowedFullAccess()
|| !container.publicGatewayMode())) {
@@ -615,10 +595,10 @@
optionForm.addChild("input", new
String[] { "type", "name", "value" }, new String[] { "submit", "download",
l10n("downloadInBackgroundToDisk")});
optionList.addChild("li").
- addChild("a", "href",
ctx.fixLink(getLink(key, requestedMimeType, maxSize,
httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload")))).addChild("#", l10n("retryNow"));
+ addChild("a", "href",
getLink(key, requestedMimeType, maxSize, httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload"))).addChild("#", l10n("retryNow"));
}
- optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { ctx.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
+ optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { "/",
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
option = optionList.addChild("li");
option.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBackToPrev")));
@@ -750,7 +730,6 @@
QueueToadlet queueToadlet = new QueueToadlet(core,
core.getFCPServer(), client);
server.register(queueToadlet, "/queue/", true,
"FProxyToadlet.queueTitle", "FProxyToadlet.queue", false, queueToadlet);
- queueToadlet.loadCompletedIdentifiers();
PproxyToadlet pproxy = new PproxyToadlet(client, node, core);
server.register(pproxy, "/plugins/", true,
"FProxyToadlet.pluginsTitle", "FProxyToadlet.plugins", true, null);
@@ -769,7 +748,6 @@
N2NTMToadlet n2ntmToadlet = new N2NTMToadlet(node, core,
client);
server.register(n2ntmToadlet, "/send_n2ntm/", true, true);
-
LocalFileInsertToadlet localFileInsertToadlet = new
LocalFileInsertToadlet(core, client);
server.register(localFileInsertToadlet, "/files/", true, false);
Modified: trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java 2009-01-21
13:45:28 UTC (rev 25182)
+++ trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java 2009-01-21
13:59:00 UTC (rev 25183)
@@ -74,7 +74,7 @@
if (peernode_name == null) {
contentNode.addChild(createPeerInfobox("infobox-error",
l10n("peerNotFoundTitle"),
l10n("peerNotFoundWithHash",
- "hash",
input_hashcode_string), ctx));
+ "hash",
input_hashcode_string)));
this.writeHTMLReply(ctx, 200, "OK", pageNode
.generate());
return;
@@ -100,7 +100,7 @@
}
private static HTMLNode createPeerInfobox(String infoboxType,
- String header, String message, ToadletContext ctx) {
+ String header, String message) {
HTMLNode infobox = new HTMLNode("div", "class", "infobox "
+ infoboxType);
infobox.addChild("div", "class", "infobox-header", header);
@@ -108,7 +108,7 @@
"infobox-content");
infoboxContent.addChild("#", message);
HTMLNode list = infoboxContent.addChild("ul");
- Toadlet.addHomepageLink(list, ctx);
+ Toadlet.addHomepageLink(list);
list.addChild("li").addChild("a", new String[] { "href",
"title" },
new String[] { "/friends/",
l10n("returnToFriends") },
l10n("friends"));
@@ -153,7 +153,7 @@
filename = new File(fnam);
if(!(filename.exists() && filename.canRead())) {
peerTableInfobox.addChild("#",
l10n("noSuchFileOrCannotRead"));
-
Toadlet.addHomepageLink(peerTableInfobox, ctx);
+
Toadlet.addHomepageLink(peerTableInfobox);
this.writeHTMLReply(ctx, 400, "OK",
pageNode.generate());
return;
}
@@ -174,7 +174,7 @@
status =
pn.sendFileOffer(filename, message);
} catch (IOException e) {
peerTableInfobox.addChild("#", l10n("noSuchFileOrCannotRead"));
-
Toadlet.addHomepageLink(peerTableInfobox, ctx);
+
Toadlet.addHomepageLink(peerTableInfobox);
this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
return;
}
@@ -221,7 +221,7 @@
"n2ntm-message-text");
infoboxContent.addChild("#", message);
HTMLNode list = peerTableInfobox.addChild("ul");
- Toadlet.addHomepageLink(list, ctx);
+ Toadlet.addHomepageLink(list);
list.addChild("li").addChild("a", new String[] {
"href", "title" },
new String[] { "/friends/",
l10n("returnToFriends") },
l10n("friends"));
Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-21
13:45:28 UTC (rev 25182)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-21
13:59:00 UTC (rev 25183)
@@ -86,6 +86,7 @@
this.fcp = fcp;
if(fcp == null) throw new NullPointerException();
fcp.setCompletionCallback(this);
+ loadCompletedIdentifiers();
}
@Override
@@ -126,7 +127,7 @@
}
MultiValueTable<String, String> responseHeaders
= new MultiValueTable<String, String>();
- responseHeaders.put("Location",
ctx.fixLink("/files/?key="+insertURI.toASCIIString()));
+ responseHeaders.put("Location",
"/files/?key="+insertURI.toASCIIString());
ctx.sendReplyHeaders(302, "Found",
responseHeaders, null, 0);
return;
}
@@ -134,7 +135,7 @@
String pass = request.getPartAsString("formPassword",
32);
if ((pass.length() == 0) ||
!pass.equals(core.formPassword)) {
MultiValueTable<String, String> headers = new
MultiValueTable<String, String>();
- headers.put("Location", ctx.fixLink("/queue/"));
+ headers.put("Location", "/queue/");
ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
if(logMINOR) Logger.minor(this, "No
formPassword: "+pass);
return;
@@ -167,7 +168,7 @@
}
}
fcp.forceStorePersistentRequests();
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done", "/queue/");
return;
} else if(request.isPartSet("remove_AllRequests") &&
(request.getPartAsString("remove_AllRequests", 32).length() > 0)) {
@@ -196,7 +197,7 @@
new
String[]{ failedIdentifiers.toString() }
));
else
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
"/queue/");
fcp.forceStorePersistentRequests();
return;
}else if(request.isPartSet("download")) {
@@ -224,13 +225,13 @@
this.writeError(L10n.getString("QueueToadlet.errorDToDisk"),
L10n.getString("QueueToadlet.errorDToDiskConfig"), ctx);
return;
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done", "/queue/");
return;
}else if(request.isPartSet("bulkDownloads")) {
String bulkDownloadsAsString =
request.getPartAsString("bulkDownloads", Integer.MAX_VALUE);
String[] keys =
bulkDownloadsAsString.split("\n");
if(("".equals(bulkDownloadsAsString)) ||
(keys.length < 1)) {
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
"/queue/");
return;
}
LinkedList<String> success = new
LinkedList<String>(), failure = new LinkedList<String>();
@@ -277,7 +278,7 @@
}
failureDiv.addChild("br");
}
- alertContent.addChild("a", "href",
ctx.fixLink("/queue/"), L10n.getString("Toadlet.returnToQueuepage"));
+ alertContent.addChild("a", "href", "/queue/",
L10n.getString("Toadlet.returnToQueuepage"));
writeHTMLReply(ctx, 200, "OK",
pageNode.generate());
return;
} else if (request.isPartSet("change_priority")) {
@@ -291,7 +292,7 @@
break loop;
}
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done", "/queue/");
fcp.forceStorePersistentRequests();
return;
} else if (request.getPartAsString("insert",
128).length() > 0) {
@@ -341,7 +342,7 @@
writeError(L10n.getString("QueueToadlet.errorInvalidURI"),
L10n.getString("QueueToadlet.errorInvalidURIToU"), ctx);
return;
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done", "/queue/");
return;
} else if (request.isPartSet("insert-local-file")) {
String filename =
request.getPartAsString("filename", MAX_FILENAME_LENGTH);
@@ -379,7 +380,7 @@
this.writeError(L10n.getString("QueueToadlet.errorAccessDenied"),
L10n.getString("QueueToadlet.errorAccessDeniedFile", new String[]{ "file" },
new String[]{ file.getName() }), ctx);
return;
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done", "/queue/");
return;
} else if (request.isPartSet("insert-local-dir")) {
String filename =
request.getPartAsString("filename", MAX_FILENAME_LENGTH);
@@ -410,7 +411,7 @@
this.writeError(L10n.getString("QueueToadlet.errorNoFileOrCannotRead"),
L10n.getString("QueueToadlet.errorAccessDeniedFile", new String[]{ "file" },
new String[]{ file.toString() }), ctx);
return;
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done", "/queue/");
return;
} else if (request.isPartSet("get")) {
String identifier =
request.getPartAsString("identifier", MAX_IDENTIFIER_LENGTH);
@@ -519,7 +520,7 @@
String mimeType =
clientGet.getMIMEType();
String
requestedMimeType = request.getParam("type", null);
String forceString =
request.getParam("force");
-
FProxyToadlet.handleDownload(ctx, data, ctx.getBucketFactory(), mimeType,
requestedMimeType, forceString, request.isParameterSet("forcedownload"),
"/queue/", key, uri, "", "/queue/", false, ctx, core);
+
FProxyToadlet.handleDownload(ctx, data, ctx.getBucketFactory(), mimeType,
requestedMimeType, forceString, request.isParameterSet("forcedownload"),
"/queue/", key, "", "/queue/", false, ctx, core);
return;
}
}
@@ -982,10 +983,10 @@
return panicBox;
}
- private HTMLNode createIdentifierCell(FreenetURI uri, String
identifier, boolean directory, ToadletContext ctx) {
+ private HTMLNode createIdentifierCell(FreenetURI uri, String
identifier, boolean directory) {
HTMLNode identifierCell = new HTMLNode("td", "class",
"request-identifier");
if (uri != null) {
- identifierCell.addChild("span", "class",
"identifier_with_uri").addChild("a", "href", ctx.fixLink("/" + uri + (directory
? "/" : "")), identifier);
+ identifierCell.addChild("span", "class",
"identifier_with_uri").addChild("a", "href", "/" + uri + (directory ? "/" :
""), identifier);
} else {
identifierCell.addChild("span", "class",
"identifier_without_uri", identifier);
}
@@ -1004,9 +1005,9 @@
return persistenceCell;
}
- private HTMLNode createDownloadCell(PageMaker pageMaker, ClientGet p,
ToadletContext ctx) {
+ private HTMLNode createDownloadCell(PageMaker pageMaker, ClientGet p) {
HTMLNode downloadCell = new HTMLNode("td", "class",
"request-download");
- downloadCell.addChild("a", "href",
ctx.fixLink("/queue/"+p.getURI().toString()),
L10n.getString("QueueToadlet.download"));
+ downloadCell.addChild("a", "href", p.getURI().toString(),
L10n.getString("QueueToadlet.download"));
return downloadCell;
}
@@ -1030,10 +1031,10 @@
return sizeCell;
}
- private HTMLNode createKeyCell(FreenetURI uri, boolean addSlash,
ToadletContext ctx) {
+ private HTMLNode createKeyCell(FreenetURI uri, boolean addSlash) {
HTMLNode keyCell = new HTMLNode("td", "class", "request-key");
if (uri != null) {
- keyCell.addChild("span", "class",
"key_is").addChild("a", "href", ctx.fixLink('/' + uri.toString() + (addSlash ?
"/" : "")), uri.toShortString() + (addSlash ? "/" : ""));
+ keyCell.addChild("span", "class",
"key_is").addChild("a", "href", '/' + uri.toString() + (addSlash ? "/" : ""),
uri.toShortString() + (addSlash ? "/" : ""));
} else {
keyCell.addChild("span", "class", "key_unknown",
L10n.getString("QueueToadlet.unknown"));
}
@@ -1093,9 +1094,9 @@
for (int columnIndex = 0, columnCount = columns.length;
columnIndex < columnCount; columnIndex++) {
int column = columns[columnIndex];
if (column == LIST_IDENTIFIER) {
- headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=id" : "?sortBy=id&reversed"))).addChild("#",
L10n.getString("QueueToadlet.identifier"));
+ headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=id" : "?sortBy=id&reversed")).addChild("#",
L10n.getString("QueueToadlet.identifier"));
} else if (column == LIST_SIZE) {
- headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=size" :
"?sortBy=size&reversed"))).addChild("#", L10n.getString("QueueToadlet.size"));
+ headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=size" : "?sortBy=size&reversed")).addChild("#",
L10n.getString("QueueToadlet.size"));
} else if (column == LIST_DOWNLOAD) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.download"));
} else if (column == LIST_MIME_TYPE) {
@@ -1107,13 +1108,13 @@
} else if (column == LIST_FILENAME) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.fileName"));
} else if (column == LIST_PRIORITY) {
- headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=priority" :
"?sortBy=priority&reversed"))).addChild("#",
L10n.getString("QueueToadlet.priority"));
+ headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=priority" : "?sortBy=priority&reversed")).addChild("#",
L10n.getString("QueueToadlet.priority"));
} else if (column == LIST_FILES) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.files"));
} else if (column == LIST_TOTAL_SIZE) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.totalSize"));
} else if (column == LIST_PROGRESS) {
- headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=progress" :
"?sortBy=progress&reversed"))).addChild("#",
L10n.getString("QueueToadlet.progress"));
+ headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=progress" : "?sortBy=progress&reversed")).addChild("#",
L10n.getString("QueueToadlet.progress"));
} else if (column == LIST_REASON) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.reason"));
}
@@ -1126,11 +1127,11 @@
int column = columns[columnIndex];
if (column == LIST_IDENTIFIER) {
if (clientRequest instanceof ClientGet)
{
-
requestRow.addChild(createIdentifierCell(((ClientGet) clientRequest).getURI(),
clientRequest.getIdentifier(), false, ctx));
+
requestRow.addChild(createIdentifierCell(((ClientGet) clientRequest).getURI(),
clientRequest.getIdentifier(), false));
} else if (clientRequest instanceof
ClientPutDir) {
-
requestRow.addChild(createIdentifierCell(((ClientPutDir)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), true, ctx));
+
requestRow.addChild(createIdentifierCell(((ClientPutDir)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), true));
} else if (clientRequest instanceof
ClientPut) {
-
requestRow.addChild(createIdentifierCell(((ClientPut)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), false, ctx));
+
requestRow.addChild(createIdentifierCell(((ClientPut)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), false));
}
} else if (column == LIST_SIZE) {
if (clientRequest instanceof ClientGet)
{
@@ -1139,7 +1140,7 @@
requestRow.addChild(createSizeCell(((ClientPut) clientRequest).getDataSize(),
true, advancedModeEnabled));
}
} else if (column == LIST_DOWNLOAD) {
-
requestRow.addChild(createDownloadCell(pageMaker, (ClientGet) clientRequest,
ctx));
+
requestRow.addChild(createDownloadCell(pageMaker, (ClientGet) clientRequest));
} else if (column == LIST_MIME_TYPE) {
if (clientRequest instanceof ClientGet)
{
requestRow.addChild(createTypeCell(((ClientGet) clientRequest).getMIMEType()));
@@ -1150,11 +1151,11 @@
requestRow.addChild(createPersistenceCell(clientRequest.isPersistent(),
clientRequest.isPersistentForever()));
} else if (column == LIST_KEY) {
if (clientRequest instanceof ClientGet)
{
-
requestRow.addChild(createKeyCell(((ClientGet) clientRequest).getURI(), false,
ctx));
+
requestRow.addChild(createKeyCell(((ClientGet) clientRequest).getURI(), false));
} else if (clientRequest instanceof
ClientPut) {
-
requestRow.addChild(createKeyCell(((ClientPut) clientRequest).getFinalURI(),
false, ctx));
+
requestRow.addChild(createKeyCell(((ClientPut) clientRequest).getFinalURI(),
false));
}else {
-
requestRow.addChild(createKeyCell(((ClientPutDir) clientRequest).getFinalURI(),
true, ctx));
+
requestRow.addChild(createKeyCell(((ClientPutDir) clientRequest).getFinalURI(),
true));
}
} else if (column == LIST_FILENAME) {
if (clientRequest instanceof ClientGet)
{
@@ -1210,7 +1211,7 @@
}, "Save completed identifiers");
}
- void loadCompletedIdentifiers() {
+ private void loadCompletedIdentifiers() {
File completedIdentifiersList = new
File(core.node.getNodeDir(), "completed.list");
File completedIdentifiersListNew = new
File(core.node.getNodeDir(), "completed.list.bak");
if(!readCompletedIdentifiers(completedIdentifiersList)) {
@@ -1334,7 +1335,7 @@
HTMLNode text = new HTMLNode("div");
L10n.addL10nSubstitution(text,
"QueueToadlet.downloadSucceeded",
new String[] { "link", "/link",
"origlink", "/origlink", "filename", "size" },
- new String[] { "<a
href=\""+container.fixLink("/queue/"+uri.toASCIIString())+"\">", "</a>", "<a
href=\""+container.fixLink("/"+uri.toASCIIString())+"\">", "</a>", name,
SizeUtil.formatSize(size) } );
+ new String[] { "<a
href=\"/queue/"+uri.toASCIIString()+"\">", "</a>", "<a
href=\"/"+uri.toASCIIString()+"\">", "</a>", name, SizeUtil.formatSize(size) }
);
UserAlert alert =
new SimpleHTMLUserAlert(true, title, title, text,
UserAlert.MINOR) {
@Override
@@ -1368,7 +1369,7 @@
HTMLNode text = new HTMLNode("div");
L10n.addL10nSubstitution(text,
"QueueToadlet.uploadSucceeded",
new String[] { "link", "/link",
"filename", "size" },
- new String[] { "<a
href=\""+container.fixLink("/"+uri.toASCIIString())+"\">", "</a>", name,
SizeUtil.formatSize(size) } );
+ new String[] { "<a
href=\"/"+uri.toASCIIString()+"\">", "</a>", name, SizeUtil.formatSize(size) }
);
UserAlert alert =
new SimpleHTMLUserAlert(true, title, title, text,
UserAlert.MINOR) {
@Override
@@ -1399,7 +1400,7 @@
HTMLNode text = new HTMLNode("div");
L10n.addL10nSubstitution(text,
"QueueToadlet.siteUploadSucceeded",
new String[] { "link", "/link",
"filename", "size", "files" },
- new String[] { "<a
href=\""+container.fixLink("/"+uri.toASCIIString())+"\">", "</a>", name,
SizeUtil.formatSize(size), Integer.toString(files) } );
+ new String[] { "<a
href=\"/"+uri.toASCIIString()+"\">", "</a>", name, SizeUtil.formatSize(size),
Integer.toString(files) } );
UserAlert alert =
new SimpleHTMLUserAlert(true, title, title, text,
UserAlert.MINOR) {
@Override
Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2009-01-21 13:45:28 UTC (rev 25182)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2009-01-21 13:59:00 UTC (rev 25183)
@@ -349,7 +349,7 @@
url += fixLink("/");
else
url += "/";
- File f = new File(node.getNodeDir(), "freenet.url.dat");
+ File f = new File(node.getNodeDir(), "freenet.url");
FileOutputStream fos = null;
try {
fos = new FileOutputStream(f);
@@ -357,8 +357,8 @@
osw.write(url+(File.separatorChar == '\\' ? "\r" : "")
+ "\n");
osw.flush();
} catch (IOException e) {
- Logger.error(this, "Unable to write URL "+url+" to
freenet.url.dat: browse.sh/browse.cmd may have difficulty! : "+e, e);
- System.err.println("Unable to write URL "+url+" to
freenet.url.dat: browse.sh/browse.cmd may have difficulty! : "+e);
+ Logger.error(this, "Unable to write URL "+url+" to
freenet.url: browse.sh/browse.cmd may have difficulty! : "+e, e);
+ System.err.println("Unable to write URL "+url+" to
freenet.url: browse.sh/browse.cmd may have difficulty! : "+e);
} finally {
Closer.close(fos);
}
@@ -834,6 +834,7 @@
public String generateSID(String realPath) throws
URLEncodedFormatException {
MessageDigest md = SHA256.getMessageDigest();
+ String oldRealPath = realPath;
realPath = prepareForSID(realPath);
try {
md.update(realPath.getBytes("UTF-8"));
Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2009-01-21 13:45:28 UTC
(rev 25182)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2009-01-21 13:59:00 UTC
(rev 25183)
@@ -228,7 +228,7 @@
infoboxContent.addChild("br");
infoboxContent.addChild("a", "href", ".",
l10n("returnToPrevPage"));
infoboxContent.addChild("br");
- addHomepageLink(infoboxContent, ctx);
+ addHomepageLink(infoboxContent);
writeHTMLReply(ctx, code, desc, pageNode.generate());
}
@@ -259,7 +259,7 @@
infoboxContent.addChild("pre", sw.toString());
infoboxContent.addChild("br");
infoboxContent.addChild("a", "href", ".",
l10n("returnToPrevPage"));
- addHomepageLink(infoboxContent, ctx);
+ addHomepageLink(infoboxContent);
writeHTMLReply(ctx, 500, desc, pageNode.generate());
}
@@ -276,8 +276,8 @@
writeHTMLReply(ctx, 500, "Internal Error", msg);
}
- protected static void addHomepageLink(HTMLNode content, ToadletContext
ctx) {
- content.addChild("a", new String[]{"href", "title"}, new
String[]{ctx.fixLink("/"), l10n("homepage")}, l10n("returnToNodeHomepage"));
+ protected static void addHomepageLink(HTMLNode content) {
+ content.addChild("a", new String[]{"href", "title"}, new
String[]{"/", l10n("homepage")}, l10n("returnToNodeHomepage"));
}
/**
Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2009-01-21
13:45:28 UTC (rev 25182)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2009-01-21
13:59:00 UTC (rev 25183)
@@ -289,7 +289,7 @@
}
}
content.addChild("br");
- addHomepageLink(content, ctx);
+ addHomepageLink(content);
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
request.freeParts();
@@ -344,7 +344,7 @@
}
content.addChild("br");
- addHomepageLink(content, ctx);
+ addHomepageLink(content);
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
request.freeParts();
@@ -556,12 +556,7 @@
// Search form
if(core.node.pluginManager != null &&
core.node.pluginManager.isPluginLoaded("plugins.XMLLibrarian.XMLLibrarian")) {
- // XMLLibrarian <= version 18 only support GET.
- // But GET forms don't work with secureid checking enabled.
- // FIXME eventually switch to all POST.
- HTMLNode form = ctx.getContainer().isSecureIDCheckingDisabled()
?
- searchBox.addChild("form", new String[] {
"method", "action" }, new String[] { "GET",
"/plugins/plugins.XMLLibrarian.XMLLibrarian" }) :
- ctx.addFormChild(searchBox,
"/plugins/plugins.XMLLibrarian.XMLLibrarian", "searchBox");
+ HTMLNode form = searchBox.addChild("form", new String[] {
"method", "action" }, new String[] { "GET",
"/plugins/plugins.XMLLibrarian.XMLLibrarian" });
form.addChild("input", new String[] { "type", "name", "value"
}, new String[] { "hidden", "choice", "index" });
form.addChild("input", new String[] { "type", "size", "name" },
new String[] { "text", "80", "search" });
form.addChild("input", new String[] { "type", "name", "value"
}, new String[] { "submit", "find", "Search Freenet!" });
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2009-01-21
13:45:28 UTC (rev 25182)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2009-01-21
13:59:00 UTC (rev 25183)
@@ -1146,7 +1146,7 @@
SimpleToadletServer.enableActivelinks=Enable activelinks?
SimpleToadletServer.enableActivelinksLong=Should the Browse Freenet page show
icons for each bookmarked page? The page will load faster if it doesn't show
the icons...
SimpleToadletServer.enableHistoryCloaking=Enable history cloaking?
-SimpleToadletServer.enableHistoryCloakingLong=Prevent websites from being able
to tell which freesites you have visited. If true, the Freenet web interface
will require a ?secureid= parameter on every page. Links on freesites and on
the web interface will include this, and Freenet will generate a file
freenet.url.dat for the start url, including the ?secureid=. Only turn this off
if you never use the same browser for Freenet as for non-anonymous websites.
+SimpleToadletServer.enableHistoryCloakingLong=Prevent websites from being able
to tell which freesites you have visited. If true, the Freenet web interface
will require a ?secureid= parameter on every page. Links on freesites and on
the web interface will include this, and Freenet will generate a file
freenet.url for the start url, including the ?secureid=. Only turn this off if
you never use the same browser for Freenet as for non-anonymous websites.
SimpleToadletServer.enableJS=Enable FProxy use of Javascript?
SimpleToadletServer.enableJSLong=Whether or not FProxy should use Javascript
"helpers". This setting should be turned to false in most cases. Note that
freesites may not use javascript even if this is enabled.
SimpleToadletServer.enabled=Enable FProxy?
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs