Author: toad Date: 2009-01-22 18:57:06 +0000 (Thu, 22 Jan 2009) New Revision: 25219
Added: branches/db4o/freenet/src/freenet/clients/http/SimpleHelpToadlet.java branches/db4o/freenet/src/freenet/support/StringValidityChecker.java branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java Modified: branches/db4o/freenet/ branches/db4o/freenet/README branches/db4o/freenet/src/freenet/client/DefaultMIMETypes.java branches/db4o/freenet/src/freenet/client/FailureCodeTracker.java branches/db4o/freenet/src/freenet/clients/http/ConnectionsToadlet.java branches/db4o/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java branches/db4o/freenet/src/freenet/clients/http/FProxyToadlet.java branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java branches/db4o/freenet/src/freenet/clients/http/HTTPRequestImpl.java branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java branches/db4o/freenet/src/freenet/clients/http/N2NTMToadlet.java branches/db4o/freenet/src/freenet/clients/http/QueueToadlet.java branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java branches/db4o/freenet/src/freenet/clients/http/ToadletContainer.java branches/db4o/freenet/src/freenet/clients/http/WelcomeToadlet.java branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java branches/db4o/freenet/src/freenet/clients/http/filter/HTMLFilter.java branches/db4o/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css branches/db4o/freenet/src/freenet/crypt/Util.java branches/db4o/freenet/src/freenet/crypt/Yarrow.java branches/db4o/freenet/src/freenet/io/comm/Message.java branches/db4o/freenet/src/freenet/io/comm/MessageCore.java branches/db4o/freenet/src/freenet/io/comm/MessageFilter.java branches/db4o/freenet/src/freenet/io/comm/MessageType.java branches/db4o/freenet/src/freenet/io/comm/PeerContext.java branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java branches/db4o/freenet/src/freenet/keys/FreenetURI.java branches/db4o/freenet/src/freenet/keys/USK.java branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties branches/db4o/freenet/src/freenet/pluginmanager/PluginHandler.java branches/db4o/freenet/src/freenet/pluginmanager/PluginInfoWrapper.java branches/db4o/freenet/src/freenet/pluginmanager/PluginManager.java branches/db4o/freenet/src/freenet/store/BerkeleyDBFreenetStore.java branches/db4o/freenet/src/freenet/store/RAMFreenetStore.java branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java branches/db4o/freenet/src/freenet/support/BinaryBloomFilter.java branches/db4o/freenet/src/freenet/support/BloomFilter.java branches/db4o/freenet/src/freenet/support/CountingBloomFilter.java branches/db4o/freenet/src/freenet/support/HTMLEncoder.java branches/db4o/freenet/src/freenet/support/HTMLNode.java branches/db4o/freenet/src/freenet/support/JarClassLoader.java branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java branches/db4o/freenet/src/freenet/support/PooledExecutor.java branches/db4o/freenet/src/freenet/support/TransferThread.java branches/db4o/freenet/src/freenet/support/URIPreEncoder.java branches/db4o/freenet/src/freenet/support/io/MultiReaderBucket.java branches/db4o/freenet/src/freenet/support/io/TempBucketFactory.java branches/db4o/freenet/test/freenet/clients/http/filter/ContentFilterTest.java branches/db4o/freenet/test/freenet/support/io/MockInputStream.java Log: Merge up to 25205 Property changes on: branches/db4o/freenet ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/freenet:19964-24445 + /trunk/freenet:19964-25205 Modified: branches/db4o/freenet/README =================================================================== --- branches/db4o/freenet/README 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/README 2009-01-22 18:57:06 UTC (rev 25219) @@ -1,32 +1,104 @@ -This is the 0.7 rewrite of Freenet. This is largely rewritten from scratch, -although it pulls in a load of code from Dijjer. +INTRODUCTION: -Major changes: -- Freenet now uses UDP -- Freenet now uses 32kB fixed block sizes -- Many more... +The Freenet Project is very pleased to announce the release of Freenet 0.7.0. -Freenet is under the GPLv2 - see LICENSE.Freenet. However, we use some other -code: -- Mantissa is under the modified BSD license. See README.Mantissa. According - to the FSF, modified BSD is compatible with GPL; we must include both - licenses. +Freenet is software designed to allow the free exchange of information over the +Internet without fear of censorship, or reprisal. To achieve this Freenet makes it +very difficult for adversaries to reveal the identity, either of the person +publishing, or downloading content. The Freenet project started in 1999, released +Freenet 0.1 in March 2000, and has been under active development ever since. -The installer creates a firefox profile. If you don't use it, you should have a -look at user.js in the firefox_profile directory for some useful settings for -browsing Freenet (both for performance and security). Occasionally, Firefox can -decide that the Freenet profile should be the default profile. In the past this -has happened if you close the Freenet browser window after the main firefox -window, but recently (FF2, FF3), we have been unable to reproduce the bug, -although we continue to get reports from time to time. Anyway, to fix it, open -a command line, cd to where firefox is installed, and type: +Freenet is unique in that it handles the storage of content, meaning that if +necessary users can upload content to Freenet and then disconnect. We've +discovered that this is a key requirement for many Freenet users. Once uploaded, +content is mirrored and moved around the Freenet network, making it very difficult +to trace, or to destroy. Content will remain in Freenet for as long as people are +retrieving it, although Freenet makes no guarantee that content will be stored +indefinitely. -firefox -ProfileManager +The journey towards Freenet 0.7 began in 2005 with the realization that some of +Freenet's most vulnerable users needed to hide the fact that they were using +Freenet, not just what they were doing with it. The result of this realization was a +ground-up redesign and rewrite of Freenet, adding a "darknet" capability, allowing +users to limit who their Freenet software would communicate with to trusted friends. +This would make it far more difficult for a third-party to determine who is using +Freenet. -And choose which profile you want. +Freenet 0.7 also embodies significant improvements to almost every other aspect of +Freenet, including efficiency, security, and usability. Freenet is available for Windows, +Linux, and OSX. It can be downloaded from: +http://freenetproject.org/download.html + +If you have any difficulty getting Freenet to work, or any questions not answered in the +faq, please join us on IRC in the #freenet channel at irc.freenode.net. Thank you. + +This release would not have been possible without the efforts of numerous volunteers, and +Matthew Toseland, Freenet's full time developer. Matthew's work is funded through donations +via our website (as well as a few larger sponsors from time to time). We ask that anyone +who can help us to ensure Matthew's continued employment visit our donations page and +make a contribution at: + +http://freenetproject.org/donate.html + +Press enquiries should be directed to Ian Clarke. + +ALWAYS ON: On OS/X and unix-based systems, Freenet will create a cron job to run Freenet on startup. On Windows it creates a user for Freenet to run under, and a service to start it. You should run Freenet as close to 24x7 as possible for good performance. It is however possible to remove the cron job (with the remove cron job script in bin/), or to remove the service (from the services panel in Control Panel). + +BASIC SECURITY: +You MUST use a separate browser to access Freenet than the one you use to access +the WWW at large. Browser history stealing attacks enable malicious websites to +probe for specific freesites you have visited. It may also be possible for hostile +websites to probe for the existence of Freenet by javascript port scanning or +similar attacks, or possibly even time loads of specific pages from Freenet, from +the browser you use for the web; this last attack is unconfirmed at the time of +writing. + +MORE SECURITY: +If your life or liberty depends on Freenet protecting your anonymity, you should +seriously evaluate your options, including the option of not posting whatever +controversial content it is you are thinking of posting. Freenet has not yet +reached version 1.0, and several important security features have not yet been +implemented; there are several known attacks which future versions will greatly +reduce, and there are likely to be (and have been) serious bugs. If you do +choose to use Freenet under such circumstances, you should enable the MAXIMUM +network security level and add connections to your friends on the Friends page; +connecting only to friends considerably improves your security against a variety +of attacks, but you should only connect to them if you know them or have some +reason to (at least minimally) trust them; connecting to arbitrary strangers +from IRC may end up with you adding the bad guys as Friends, and apart from that +it damages the network topology. + +CHANGES FROM 0.5: +This is the 0.7 rewrite of Freenet. This is largely rewritten from scratch, +although it pulls in a load of code from Dijjer, and most of the crypto and a +few other classes from the 0.5 source. + +Major changes: +- Darknet mode: connect only to your friends, they connect to theirs, this forms + a small-world network, which Freenet makes routable by location swapping. This + greatly increases the network's robustness as it makes it much harder to find + and block Freenet nodes on a national firewall, as well as improving security + generally provided that your friends are trustworthy. +- Opennet mode (plug and play) is also supported. Just select network security + level NORMAL or LOW in the first-time wizard. +- Freenet now uses UDP, mainly to improve connectivity over NATs and firewalls. +- Freenet now uses 32kB fixed block sizes, to improve performance and simplify + the code. +- The Freenet Client Protocol is completely different, see the spec here: + http://wiki.freenetproject.org/FreenetFCPSpec2Point0 +- Many more changes... + +LICENSING: +Freenet is under the GPLv2 - see LICENSE.Freenet (we are trying to make this +GPL 2 or later, but some code is arguably GPL 2 only). However, we use some +other code: +- Mantissa is under the modified BSD license. See README.Mantissa. According + to the FSF, modified BSD is compatible with GPL; we must include both + licenses. + Modified: branches/db4o/freenet/src/freenet/client/DefaultMIMETypes.java =================================================================== --- branches/db4o/freenet/src/freenet/client/DefaultMIMETypes.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/client/DefaultMIMETypes.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -63,7 +63,7 @@ */ protected static synchronized void addMIMEType(short number, String type, String[] extensions, String outExtension) { addMIMEType(number, type); - Short t = new Short(number); + Short t = Short.valueOf(number); if(extensions != null) { for(int i=0;i<extensions.length;i++) { String ext = extensions[i].toLowerCase(); Modified: branches/db4o/freenet/src/freenet/client/FailureCodeTracker.java =================================================================== --- branches/db4o/freenet/src/freenet/client/FailureCodeTracker.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/client/FailureCodeTracker.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -40,7 +40,7 @@ int num = Integer.parseInt(name); int count = Integer.parseInt(f.get("Count")); if(count < 0) throw new IllegalArgumentException("Count < 0"); - map.put(new Integer(num), new Item(count)); + map.put(Integer.valueOf(num), new Item(count)); total += count; } } Modified: branches/db4o/freenet/src/freenet/clients/http/ConnectionsToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/ConnectionsToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -843,7 +843,7 @@ String messageName = entry.getKey(); Long messageCount = entry.getValue(); messageNames.add(messageName); - messageCounts.put(messageName, new Long[] { messageCount, new Long(0) }); + messageCounts.put(messageName, new Long[] { messageCount, Long.valueOf(0) }); } for (Map.Entry<String,Long> entry : peerNodeStatus.getLocalMessagesSent().entrySet() ) { String messageName = entry.getKey(); @@ -853,7 +853,7 @@ } Long[] existingCounts = messageCounts.get(messageName); if (existingCounts == null) { - messageCounts.put(messageName, new Long[] { new Long(0), messageCount }); + messageCounts.put(messageName, new Long[] { Long.valueOf(0), messageCount }); } else { existingCounts[1] = messageCount; } Modified: branches/db4o/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -191,9 +191,7 @@ } } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("enable")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -204,9 +202,7 @@ peerNodes[i].enablePeer(); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("disable")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -217,9 +213,7 @@ peerNodes[i].disablePeer(); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("set_burst_only")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -230,9 +224,7 @@ peerNodes[i].setBurstOnly(true); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("clear_burst_only")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -243,9 +235,7 @@ peerNodes[i].setBurstOnly(false); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("set_ignore_source_port")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -256,9 +246,7 @@ peerNodes[i].setIgnoreSourcePort(true); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("clear_ignore_source_port")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -269,9 +257,7 @@ peerNodes[i].setIgnoreSourcePort(false); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("clear_dont_route")) { DarknetPeerNode[] peerNodes = node.getDarknetConnections(); @@ -280,9 +266,7 @@ peerNodes[i].setRoutingStatus(true, true); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("set_dont_route")) { DarknetPeerNode[] peerNodes = node.getDarknetConnections(); @@ -291,9 +275,7 @@ peerNodes[i].setRoutingStatus(false, true); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("set_listen_only")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -304,9 +286,7 @@ peerNodes[i].setListenOnly(true); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("clear_listen_only")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -317,9 +297,7 @@ peerNodes[i].setListenOnly(false); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("set_allow_local")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -330,9 +308,7 @@ peerNodes[i].setAllowLocalAddresses(true); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("clear_allow_local")) { //int hashcode = Integer.decode(request.getParam("node")).intValue(); @@ -343,9 +319,7 @@ peerNodes[i].setAllowLocalAddresses(false); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("remove") || (request.isPartSet("doAction") && request.getPartAsString("action",25).equals("remove"))) { if(logMINOR) Logger.minor(this, "Remove node"); @@ -377,9 +351,7 @@ if(logMINOR) Logger.minor(this, "Part not set: node_"+peerNodes[i].hashCode()); } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("acceptTransfer")) { // FIXME this is ugly, should probably move both this code and the PeerNode code somewhere. @@ -391,9 +363,7 @@ break; } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else if (request.isPartSet("rejectTransfer")) { // FIXME this is ugly, should probably move both this code and the PeerNode code somewhere. @@ -405,15 +375,19 @@ break; } } - MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); - headers.put("Location", "/friends/"); - ctx.sendReplyHeaders(302, "Found", headers, null, 0); + redirectHere(ctx); return; } else { this.handleGet(uri, new HTTPRequestImpl(uri), ctx); } } + private void redirectHere(ToadletContext ctx) throws ToadletContextClosedException, IOException { + MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); + headers.put("Location", "/friends/"); + ctx.sendReplyHeaders(302, "Found", headers, null, 0); + } + @Override protected boolean isOpennet() { return false; Modified: branches/db4o/freenet/src/freenet/clients/http/FProxyToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -461,7 +461,7 @@ if(Logger.shouldLog(Logger.MINOR, this)) Logger.minor(this, "Failed to fetch "+uri+" : "+e); if(e.newURI != null) { - Toadlet.writePermanentRedirect(ctx, msg, '/' +e.newURI.toACIIString() + override); + Toadlet.writePermanentRedirect(ctx, msg, '/' +e.newURI.toASCIIString() + override); } else if(e.mode == FetchException.TOO_BIG) { HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("fileInformationTitle"), ctx); HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); @@ -608,7 +608,7 @@ boolean forceDownload) { StringBuilder sb = new StringBuilder(); sb.append("/"); - sb.append(uri.toACIIString()); + sb.append(uri.toASCIIString()); char c = '?'; if(requestedMimeType != null) { sb.append(c).append("type=").append(URLEncoder.encode(requestedMimeType,false)); c = '&'; @@ -680,6 +680,9 @@ UserAlertsToadlet alerts = new UserAlertsToadlet(client, node, core); server.register(alerts, "/alerts/", true, "FProxyToadlet.alertsTitle", "FProxyToadlet.alerts", true, null); + + QueueToadlet queueToadlet = new QueueToadlet(core, core.getFCPServer(), client); + server.register(queueToadlet, "/queue/", true, "FProxyToadlet.queueTitle", "FProxyToadlet.queue", false, queueToadlet); PproxyToadlet pproxy = new PproxyToadlet(client, node, core); server.register(pproxy, "/plugins/", true, "FProxyToadlet.pluginsTitle", "FProxyToadlet.plugins", true, null); @@ -687,29 +690,17 @@ WelcomeToadlet welcometoadlet = new WelcomeToadlet(client, core, node, bookmarks); server.register(welcometoadlet, "/welcome/", true, false); - ConfigToadlet configtoadlet = new ConfigToadlet(client, config, node, core); - server.register(configtoadlet, "/config/", true, "FProxyToadlet.configTitle", "FProxyToadlet.config", true, null); - SymlinkerToadlet symlinkToadlet = new SymlinkerToadlet(client, node); server.register(symlinkToadlet, "/sl/", true, false); DarknetConnectionsToadlet friendsToadlet = new DarknetConnectionsToadlet(node, core, client); -// server.register(friendsToadlet, "/darknet/", true, l10n("friendsTitle"), l10n("friends"), true); server.register(friendsToadlet, "/friends/", true, "FProxyToadlet.friendsTitle", "FProxyToadlet.friends", true, null); OpennetConnectionsToadlet opennetToadlet = new OpennetConnectionsToadlet(node, core, client); -// server.register(opennetToadlet, "/opennet/", true, l10n("opennetTitle"), l10n("opennet"), true, opennetToadlet); server.register(opennetToadlet, "/strangers/", true, "FProxyToadlet.opennetTitle", "FProxyToadlet.opennet", true, opennetToadlet); N2NTMToadlet n2ntmToadlet = new N2NTMToadlet(node, core, client); server.register(n2ntmToadlet, "/send_n2ntm/", true, true); - - QueueToadlet queueToadlet = new QueueToadlet(core, core.getFCPServer(), client); - server.register(queueToadlet, "/queue/", true, "FProxyToadlet.queueTitle", "FProxyToadlet.queue", false, queueToadlet); - - StatisticsToadlet statisticsToadlet = new StatisticsToadlet(node, core, client); - server.register(statisticsToadlet, "/stats/", true, "FProxyToadlet.statsTitle", "FProxyToadlet.stats", true, null); - LocalFileInsertToadlet localFileInsertToadlet = new LocalFileInsertToadlet(core, client); server.register(localFileInsertToadlet, "/files/", true, false); @@ -718,6 +709,9 @@ BrowserTestToadlet browsertTestToadlet = new BrowserTestToadlet(client, core); server.register(browsertTestToadlet, "/test/", true, false); + + StatisticsToadlet statisticsToadlet = new StatisticsToadlet(node, core, client); + server.register(statisticsToadlet, "/stats/", true, "FProxyToadlet.statsTitle", "FProxyToadlet.stats", true, null); ConnectivityToadlet connectivityToadlet = new ConnectivityToadlet(client, node, core); server.register(connectivityToadlet, "/connectivity/", true, "ConnectivityToadlet.connectivityTitle", "ConnectivityToadlet.connectivity", true, null); @@ -728,6 +722,12 @@ FirstTimeWizardToadlet firstTimeWizardToadlet = new FirstTimeWizardToadlet(client, node, core); server.register(firstTimeWizardToadlet, FirstTimeWizardToadlet.TOADLET_URL, true, false); + ConfigToadlet configtoadlet = new ConfigToadlet(client, config, node, core); + server.register(configtoadlet, "/config/", true, "FProxyToadlet.configTitle", "FProxyToadlet.config", true, null); + + SimpleHelpToadlet simpleHelpToadlet = new SimpleHelpToadlet(client, core); + server.register(simpleHelpToadlet, "/help/", true, false); + } /** Modified: branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -39,6 +39,9 @@ private enum WIZARD_STEP { WELCOME, + // Before security levels, because once the network security level has been set, we won't redirect + // the user to the wizard page. + BROWSER_WARNING, SECURITY_NETWORK, SECURITY_FRIENDS, SECURITY_PHYSICAL, @@ -68,7 +71,23 @@ WIZARD_STEP currentStep = WIZARD_STEP.valueOf(request.getParam("step", WIZARD_STEP.WELCOME.toString())); - if(currentStep == WIZARD_STEP.SECURITY_NETWORK) { + if(currentStep == WIZARD_STEP.BROWSER_WARNING) { + HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("browserWarningPageTitle"), false, ctx); + HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); + + HTMLNode infobox = contentNode.addChild("div", "class", "infobox infobox-normal"); + HTMLNode infoboxHeader = infobox.addChild("div", "class", "infobox-header"); + HTMLNode infoboxContent = infobox.addChild("div", "class", "infobox-content"); + + infoboxHeader.addChild("#", l10n("browserWarningShort")); + L10n.addL10nSubstitution(infoboxContent, "FirstTimeWizardToadlet.browserWarning", new String[] { "bold", "/bold" }, new String[] { "<b>", "</b>" }); + infoboxContent.addChild("p", l10n("browserWarningSuggestion")); + + infoboxContent.addChild("p").addChild("a", "href", "?step="+WIZARD_STEP.SECURITY_NETWORK, L10n.getString("FirstTimeWizardToadlet.clickContinue")); + + this.writeHTMLReply(ctx, 200, "OK", pageNode.generate()); + return; + } else if(currentStep == WIZARD_STEP.SECURITY_NETWORK) { HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("networkSecurityPageTitle"), false, ctx); HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); @@ -316,7 +335,7 @@ HTMLNode firstParagraph = welcomeInfoboxContent.addChild("p"); firstParagraph.addChild("#", l10n("welcomeInfoboxContent1")); HTMLNode secondParagraph = welcomeInfoboxContent.addChild("p"); - secondParagraph.addChild("a", "href", "?step="+WIZARD_STEP.SECURITY_NETWORK).addChild("#", L10n.getString("FirstTimeWizardToadlet.clickContinue")); + secondParagraph.addChild("a", "href", "?step="+WIZARD_STEP.BROWSER_WARNING).addChild("#", L10n.getString("FirstTimeWizardToadlet.clickContinue")); HTMLNode thirdParagraph = welcomeInfoboxContent.addChild("p"); thirdParagraph.addChild("a", "href", "?step="+WIZARD_STEP.FINAL).addChild("#", l10n("skipWizard")); @@ -459,11 +478,11 @@ super.writeTemporaryRedirect(ctx, "step3", TOADLET_URL+"?step="+WIZARD_STEP.BANDWIDTH); return; } else if(request.isPartSet("bwF")) { - _setUpstreamBandwidthLimit(request.getPartAsString("bw", 6)); + _setUpstreamBandwidthLimit(request.getPartAsString("bw", 20)); // drop down options may be 6 chars or less, but formatted ones e.g. old value if re-running can be more super.writeTemporaryRedirect(ctx, "step4", TOADLET_URL+"?step="+WIZARD_STEP.DATASTORE_SIZE); return; } else if(request.isPartSet("dsF")) { - _setDatastoreSize(request.getPartAsString("ds", 6)); + _setDatastoreSize(request.getPartAsString("ds", 20)); // drop down options may be 6 chars or less, but formatted ones e.g. old value if re-running can be more super.writeTemporaryRedirect(ctx, "step5", TOADLET_URL+"?step="+WIZARD_STEP.MEMORY); return; } else if(request.isPartSet("memoryF")) { @@ -571,17 +590,17 @@ return false; else { String shortSize = null; - if(freeSpace / 20 > 1024 * 1024 * 1024) { + if(freeSpace / 20 > 1024 * 1024 * 1024) { // 20GB+ => 5%, limit 256GB // If 20GB+ free, 5% of available disk space. // Maximum of 256GB. That's a 128MB bloom filter. shortSize = SizeUtil.formatSize(Math.min(freeSpace / 20, 256*1024*1024*1024L)); - }else if(freeSpace / 10 > 1024 * 1024 * 1024) { + }else if(freeSpace / 10 > 1024 * 1024 * 1024) { // 10GB+ => 10% // If 10GB+ free, 10% of available disk space. shortSize = SizeUtil.formatSize(freeSpace / 10); - }else if(freeSpace / 5 > 1024 * 1024 * 1024) { + }else if(freeSpace / 5 > 1024 * 1024 * 1024) { // 5GB+ => 512MB // If 5GB+ free, default to 512MB shortSize = "512MB"; - }else + }else // <5GB => 256MB shortSize = "256MB"; _setDatastoreSize(shortSize); Modified: branches/db4o/freenet/src/freenet/clients/http/HTTPRequestImpl.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/HTTPRequestImpl.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/HTTPRequestImpl.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -353,7 +353,7 @@ List<Integer> intValueList = new ArrayList<Integer>(); for (int i = 0; i < valueList.size(); i++) { try { - intValueList.add(new Integer(valueList.get(i))); + intValueList.add(Integer.valueOf(valueList.get(i))); } catch (Exception e) { // ignore invalid parameter values } Modified: branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -53,7 +53,7 @@ } String extra = ""; if(furi != null) - extra = "&key="+furi.toACIIString(); + extra = "&key="+furi.toASCIIString(); String path = request.getParam("path"); if (path.length() == 0) { @@ -128,7 +128,7 @@ formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "filename", currentFile.getAbsolutePath() }); formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "insert-local-dir", l10n("insert")}); if(furi != null) - formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "key", furi.toACIIString() }); + formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "key", furi.toASCIIString() }); HTMLNode directoryCellNode = fileRow.addChild("td"); directoryCellNode.addChild("a", "href", "?path=" + URLEncoder.encode(currentFile.getAbsolutePath(),false)+extra, currentFile.getName()); } else { @@ -143,7 +143,7 @@ formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "filename", currentFile.getAbsolutePath() }); formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "insert-local-file", l10n("insert")}); if(furi != null) - formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "key", furi.toACIIString() }); + formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "key", furi.toASCIIString() }); fileRow.addChild("td", currentFile.getName()); fileRow.addChild("td", "class", "right-align", String.valueOf(currentFile.length())); } else { Modified: branches/db4o/freenet/src/freenet/clients/http/N2NTMToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/N2NTMToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/N2NTMToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -56,7 +56,7 @@ .getParam("peernode_hashcode"); int input_hashcode = -1; try { - input_hashcode = (new Integer(input_hashcode_string)) + input_hashcode = (Integer.valueOf(input_hashcode_string)) .intValue(); } catch (NumberFormatException e) { // ignore here, handle below Modified: branches/db4o/freenet/src/freenet/clients/http/QueueToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -136,7 +136,7 @@ } MultiValueTable responseHeaders = new MultiValueTable<String, String>(); - responseHeaders.put("Location", "/files/?key="+insertURI.toACIIString()); + responseHeaders.put("Location", "/files/?key="+insertURI.toASCIIString()); ctx.sendReplyHeaders(302, "Found", responseHeaders, null, 0); return; } @@ -1402,7 +1402,7 @@ HTMLNode text = new HTMLNode("div"); L10n.addL10nSubstitution(text, "QueueToadlet.downloadSucceeded", new String[] { "link", "/link", "origlink", "/origlink", "filename", "size" }, - new String[] { "<a href=\"/queue/"+uri.toACIIString()+"\">", "</a>", "<a href=\"/"+uri.toACIIString()+"\">", "</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 @@ -1438,7 +1438,7 @@ HTMLNode text = new HTMLNode("div"); L10n.addL10nSubstitution(text, "QueueToadlet.uploadSucceeded", new String[] { "link", "/link", "filename", "size" }, - new String[] { "<a href=\"/"+uri.toACIIString()+"\">", "</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 @@ -1469,7 +1469,7 @@ HTMLNode text = new HTMLNode("div"); L10n.addL10nSubstitution(text, "QueueToadlet.siteUploadSucceeded", new String[] { "link", "/link", "filename", "size", "files" }, - new String[] { "<a href=\"/"+uri.toACIIString()+"\">", "</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 Copied: branches/db4o/freenet/src/freenet/clients/http/SimpleHelpToadlet.java (from rev 25205, trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java) =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/SimpleHelpToadlet.java (rev 0) +++ branches/db4o/freenet/src/freenet/clients/http/SimpleHelpToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -0,0 +1,86 @@ +/* This code is part of Freenet. It is distributed under the GNU General + * Public License, version 2 (or at your option any later version). See + * http://www.gnu.org/ for further details of the GPL. */ +package freenet.clients.http; + +import java.io.IOException; +import java.net.URI; + +import freenet.client.HighLevelSimpleClient; +import freenet.node.NodeClientCore; +import freenet.support.HTMLNode; +import freenet.support.api.HTTPRequest; +import freenet.l10n.L10n; + +/** + * Simple Help Toadlet. Provides an offline means of looking up some basic info, howtos, and FAQ + * Likely to be superceded someday by an offical Freesite and binary blob included in install package. + * @author Juiceman + */ +public class SimpleHelpToadlet extends Toadlet { + SimpleHelpToadlet(HighLevelSimpleClient client, NodeClientCore c) { + super(client); + this.core=c; + } + + final NodeClientCore core; + + @Override + public void handleGet(URI uri, HTTPRequest request, ToadletContext ctx) throws ToadletContextClosedException, IOException { + + + + HTMLNode pageNode = ctx.getPageMaker().getPageNode("Freenet " + L10n.getString("FProxyToadlet.help"), ctx); + HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); + + if(ctx.isAllowedFullAccess()) + contentNode.addChild(core.alerts.createSummary()); + + // Description infobox + HTMLNode helpScreenBox1 = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-content", L10n.getString("SimpleHelpToadlet.descriptionTitle"))); + HTMLNode helpScreenContent1 = ctx.getPageMaker().getContentNode(helpScreenBox1); + helpScreenContent1.addChild("#", L10n.getString("SimpleHelpToadlet.descriptionText")); + + // Definitions infobox + HTMLNode helpScreenBox2 = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-content", L10n.getString("SimpleHelpToadlet.definitionsTitle"))); + HTMLNode helpScreenContent2 = ctx.getPageMaker().getContentNode(helpScreenBox2); + + HTMLNode table = helpScreenContent2.addChild("table", new String[]{"border", "style"}, new String[]{"0", "border: none"}); + + HTMLNode row = table.addChild("tr"); + HTMLNode cell = row.addChild("td", "style", "border: none"); + + // cell.addChild("#", " "); + // } + // cell = row.addChild("td", "style", "border: none"); + // cell.addChild("a", new String[]{"href", "title"}, new String[]{ ctx.fixLink('/' + item.getKey()), item.getDescription()}, item.getName()); + + row.addChild("#", L10n.getString("SimpleHelpToadlet.CHK")); + row.addChild("br"); + row.addChild("#", L10n.getString("SimpleHelpToadlet.SSK")); + row.addChild("br"); + row.addChild("#", L10n.getString("SimpleHelpToadlet.USK")); + + // helpScreenContent2.addchild("#", L10n.getString("SimpleHelpToadlet.CHK")); + // helpScreenContent2.addchild("br"); + // helpScreenContent2.addchild("#", L10n.getString("SimpleHelpToadlet.SSK")); + // helpScreenContent2.addchild("br"); + // helpScreenContent2.addchild("#", L10n.getString("SimpleHelpToadlet.USK")); + + + // Port forwarding, etc. + HTMLNode helpScreenBox3 = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-content", L10n.getString("SimpleHelpToadlet.connectivityTitle"))); + HTMLNode helpScreenContent3 = ctx.getPageMaker().getContentNode(helpScreenBox3); + helpScreenContent3.addChild("#", L10n.getString("SimpleHelpToadlet.connectivityText")); + + + this.writeHTMLReply(ctx, 200, "OK", pageNode.generate()); + + } + + @Override + public String supportedMethods() { + return "GET"; + } + +} Modified: branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -83,6 +83,7 @@ private boolean doRobots; private boolean enablePersistentConnections; private boolean enableInlinePrefetch; + private boolean enableActivelinks; // Something does not really belongs to here static boolean isPanicButtonToBeShown; // move to QueueToadlet ? @@ -431,6 +432,21 @@ }); enableInlinePrefetch = fproxyConfig.getBoolean("enableInlinePrefetch"); + fproxyConfig.register("enableActivelinks", false, configItemOrder++, false, false, "SimpleToadletServer.enableActivelinks", "SimpleToadletServer.enableActivelinksLong", new BooleanCallback() { + + @Override + public Boolean get() { + return enableActivelinks; + } + + @Override + public void set(Boolean val) throws InvalidConfigValueException, NodeNeedRestartException { + enableActivelinks = val; + } + + }); + enableActivelinks = fproxyConfig.getBoolean("enableActivelinks"); + fproxyConfig.register("passthroughMaxSize", 2L*1024*1024, configItemOrder++, true, false, "SimpleToadletServer.passthroughMaxSize", "SimpleToadletServer.passthroughMaxSizeLong", new FProxyPassthruMaxSize()); FProxyToadlet.MAX_LENGTH = fproxyConfig.getLong("passthroughMaxSize"); @@ -750,4 +766,10 @@ return bf; } + + + public boolean enableActivelinks() { + return enableActivelinks; + } + } Modified: branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/StatisticsToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -217,6 +217,11 @@ successRateBox.addChild("div", "class", "infobox-header", "Success rates"); HTMLNode successRateContent = successRateBox.addChild("div", "class", "infobox-content"); stats.fillSuccessRateBox(successRateContent); + + HTMLNode timeDetailBox = nextTableCell.addChild("div", "class", "infobox"); + timeDetailBox.addChild("div", "class", "infobox-header", "Detailed timings (local CHK fetches)"); + HTMLNode timingsContent = timeDetailBox.addChild("div", "class", "infobox-content"); + stats.fillDetailedTimingsBox(timingsContent); } } @@ -934,6 +939,7 @@ int numSSKRequests = numLocalSSKRequests + numRemoteSSKRequests; int numCHKInserts = numLocalCHKInserts + numRemoteCHKInserts; int numSSKInserts = numLocalSSKInserts + numRemoteSSKInserts; + int numIncomingTurtles = node.getNumIncomingTurtles(); if ((numInserts == 0) && (numRequests == 0) && (numTransferringRequests == 0) && (numCHKRequests == 0) && (numSSKRequests == 0) && (numCHKInserts == 0) && (numSSKInserts == 0) && @@ -953,9 +959,9 @@ new String[] { "totalSenders", "CHKhandlers", "SSKhandlers", "local" } , new String[] { Integer.toString(numRequests), Integer.toString(numCHKRequests), Integer.toString(numSSKRequests), Integer.toString(numLocalCHKRequests + numLocalSSKRequests)})); } - if (numTransferringRequests > 0 || numTransferringRequestHandlers > 0) { + if (numTransferringRequests > 0 || numTransferringRequestHandlers > 0 || numIncomingTurtles > 0) { activityList.addChild("li", L10n.getString("StatisticsToadlet.transferringRequests", - new String[] { "senders", "receivers" }, new String[] { Integer.toString(numTransferringRequests), Integer.toString(numTransferringRequestHandlers)})); + new String[] { "senders", "receivers", "turtles" }, new String[] { Integer.toString(numTransferringRequests), Integer.toString(numTransferringRequestHandlers), Integer.toString(numIncomingTurtles)})); } if (numCHKOfferReplys > 0 || numSSKOfferReplys > 0) { activityList.addChild("li", L10n.getString("StatisticsToadlet.offerReplys", Modified: branches/db4o/freenet/src/freenet/clients/http/ToadletContainer.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/ToadletContainer.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/ToadletContainer.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -62,4 +62,6 @@ * node etc, but everyone else will not have access to the download * queue or anything else that might conceivably result in a DoS. */ public boolean publicGatewayMode(); + + public boolean enableActivelinks(); } Modified: branches/db4o/freenet/src/freenet/clients/http/WelcomeToadlet.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/WelcomeToadlet.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/WelcomeToadlet.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -56,7 +56,7 @@ return; } - private void addCategoryToList(BookmarkCategory cat, HTMLNode list, boolean noActiveLinks) { + private void addCategoryToList(BookmarkCategory cat, HTMLNode list, boolean noActiveLinks, ToadletContext ctx) { List<BookmarkItem> items = cat.getItems(); if (items.size() > 0) { // FIXME CSS noborder ... @@ -81,7 +81,7 @@ List<BookmarkCategory> cats = cat.getSubCategories(); for (int i = 0; i < cats.size(); i++) { list.addChild("li", "class", "cat", cats.get(i).getName()); - addCategoryToList(cats.get(i), list.addChild("li").addChild("ul"), noActiveLinks); + addCategoryToList(cats.get(i), list.addChild("li").addChild("ul"), noActiveLinks, ctx); } } @@ -349,6 +349,17 @@ writeHTMLReply(ctx, 200, "OK", pageNode.generate()); request.freeParts(); bucket.free(); + } else if (request.isPartSet("exit")) { + HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("shutdownConfirmTitle"), ctx); + HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); + HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", l10n("shutdownConfirmTitle"))); + HTMLNode content = ctx.getPageMaker().getContentNode(infobox); + content.addChild("p").addChild("#", l10n("shutdownConfirm")); + HTMLNode shutdownForm = ctx.addFormChild(content.addChild("p"), "/", "confirmShutdownForm"); + shutdownForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "cancel", L10n.getString("Toadlet.cancel")}); + shutdownForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "shutdownconfirm", l10n("shutdown")}); + writeHTMLReply(ctx, 200, "OK", pageNode.generate()); + return; } else if (request.isPartSet("shutdownconfirm")) { if (noPassword) { redirectToRoot(ctx); @@ -364,6 +375,17 @@ } }, 1); return; + } else if (request.isPartSet("restart")) { + HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("restartConfirmTitle"), ctx); + HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); + HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", l10n("restartConfirmTitle"))); + HTMLNode content = ctx.getPageMaker().getContentNode(infobox); + content.addChild("p").addChild("#", l10n("restartConfirm")); + HTMLNode restartForm = ctx.addFormChild(content.addChild("p"), "/", "confirmRestartForm"); + restartForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "cancel", L10n.getString("Toadlet.cancel")}); + restartForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "restartconfirm", l10n("restart")}); + writeHTMLReply(ctx, 200, "OK", pageNode.generate()); + return; } else if (request.isPartSet("restartconfirm")) { if (noPassword) { redirectToRoot(ctx); @@ -501,28 +523,6 @@ externalLinkForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "Go", l10n("goToExternalLink")}); this.writeHTMLReply(ctx, 200, "OK", pageNode.generate()); return; - } else if (request.isParameterSet("exit")) { - HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("shutdownConfirmTitle"), ctx); - HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); - HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", l10n("shutdownConfirmTitle"))); - HTMLNode content = ctx.getPageMaker().getContentNode(infobox); - content.addChild("p").addChild("#", l10n("shutdownConfirm")); - HTMLNode shutdownForm = ctx.addFormChild(content.addChild("p"), "/", "confirmShutdownForm"); - shutdownForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "cancel", L10n.getString("Toadlet.cancel")}); - shutdownForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "shutdownconfirm", l10n("shutdown")}); - writeHTMLReply(ctx, 200, "OK", pageNode.generate()); - return; - } else if (request.isParameterSet("restart")) { - HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("restartConfirmTitle"), ctx); - HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode); - HTMLNode infobox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", l10n("restartConfirmTitle"))); - HTMLNode content = ctx.getPageMaker().getContentNode(infobox); - content.addChild("p").addChild("#", l10n("restartConfirm")); - HTMLNode restartForm = ctx.addFormChild(content.addChild("p"), "/", "confirmRestartForm"); - restartForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "cancel", L10n.getString("Toadlet.cancel")}); - restartForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "restartconfirm", l10n("restart")}); - writeHTMLReply(ctx, 200, "OK", pageNode.generate()); - return; } } @@ -550,6 +550,22 @@ if (ctx.isAllowedFullAccess()) { contentNode.addChild(core.alerts.createAlertsShort(l10n("alertsSummary"), advancedModeOutputEnabled, true)); } + + // Search Box + HTMLNode searchBox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal", L10n.getString("WelcomeToadlet.searchBoxLabel"))); + // Search form + if(core.node.pluginManager != null && + core.node.pluginManager.isPluginLoaded("plugins.XMLLibrarian.XMLLibrarian")) { + 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!" }); + } else { + // Warn that search plugin is not loaded. + HTMLNode searchBoxContent = ctx.getPageMaker().getContentNode(searchBox); + searchBoxContent.addChild("#", L10n.getString("WelcomeToadlet.searchPluginNotLoaded")); + } + // Bookmarks HTMLNode bookmarkBox = contentNode.addChild("div", "class", "infobox infobox-normal"); @@ -563,17 +579,9 @@ HTMLNode bookmarkBoxContent = bookmarkBox.addChild("div", "class", "infobox-content"); - // Search box - if(core.node.pluginManager != null && - core.node.pluginManager.isPluginLoaded("plugins.XMLLibrarian.XMLLibrarian")) { - HTMLNode form = bookmarkBoxContent.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!" }); - } - + HTMLNode bookmarksList = bookmarkBoxContent.addChild("ul", "id", "bookmarks"); - addCategoryToList(BookmarkManager.MAIN_CATEGORY, bookmarksList, useragent != null && useragent.contains("khtml") && !useragent.contains("chrome")); + addCategoryToList(BookmarkManager.MAIN_CATEGORY, bookmarksList, (!container.enableActivelinks()) || (useragent != null && useragent.contains("khtml") && !useragent.contains("chrome")), ctx); // Fetch-a-key box HTMLNode fetchKeyBox = contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal", l10n("fetchKeyLabel"))); @@ -602,11 +610,12 @@ } versionContent.addChild("br"); if (ctx.isAllowedFullAccess()) { - HTMLNode shutdownForm = versionContent.addChild("form", new String[]{"action", "method"}, new String[]{".", "get"}).addChild("div"); + HTMLNode shutdownForm = ctx.addFormChild(versionContent, ".", "shutdownForm"); shutdownForm.addChild("input", new String[]{"type", "name"}, new String[]{"hidden", "exit"}); + shutdownForm.addChild("input", new String[]{"type", "value"}, new String[]{"submit", l10n("shutdownNode")}); if (node.isUsingWrapper()) { - HTMLNode restartForm = versionContent.addChild("form", new String[]{"action", "method"}, new String[]{".", "get"}).addChild("div"); + HTMLNode restartForm = ctx.addFormChild(versionContent, ".", "restartForm"); restartForm.addChild("input", new String[]{"type", "name"}, new String[]{"hidden", "restart"}); restartForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "restart2", l10n("restartNode")}); } Modified: branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -1,4 +1,4 @@ -/* The following code was generated by JFlex 1.4.1 on 9/12/08 9:31 PM */ +/* The following code was generated by JFlex 1.4.1 on 1/4/09 3:25 PM */ /* This code is part of Freenet. It is distributed under the GNU General * Public License, version 2 (or at your option any later version). See @@ -18,8 +18,8 @@ /** * This class is a scanner generated by * <a href="http://www.jflex.de/">JFlex</a> 1.4.1 - * on 9/12/08 9:31 PM from the specification file - * <tt>./src/freenet/clients/http/filter/CSSTokenizerFilter.jflex</tt> + * on 1/4/09 3:25 PM from the specification file + * <tt>src/freenet/clients/http/filter/CSSTokenizerFilter.jflex</tt> */ class CSSTokenizerFilter { @@ -975,8 +975,8 @@ String data; public String suffix; // includes any whitespace public DecodedStringThingy(String s) { - if(s.startsWith("url(")) { - s = s.substring("url(".length()); + if(s.toLowerCase(Locale.US).startsWith("url(")) { + s = s.substring(4/* "url(".length() */); url = true; } char q = s.charAt(0); Modified: branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex 2009-01-22 18:57:06 UTC (rev 25219) @@ -88,8 +88,8 @@ String data; public String suffix; // includes any whitespace public DecodedStringThingy(String s) { - if(s.startsWith("url(")) { - s = s.substring("url(".length()); + if(s.toLowerCase(Locale.US).startsWith("url(")) { + s = s.substring(4/* "url(".length() */); url = true; } char q = s.charAt(0); Modified: branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -3,6 +3,7 @@ * http://www.gnu.org/ for further details of the GPL. */ package freenet.clients.http.filter; +import java.io.BufferedInputStream; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; @@ -117,11 +118,23 @@ this.type = type; } } - + /** * Filter some data. - * @param bf The bucket factory used to create the bucket to return the filtered data in. - * @throws IOException If an internal error involving buckets occurred. + * + * @param data + * Input data + * @param bf + * The bucket factory used to create the bucket to return the filtered data in. + * @param typeName + * MIME type for input data + * + * @throws IOException + * If an internal error involving buckets occurred. + * @throws UnsafeContentTypeException + * If the MIME type is declared unsafe (e.g. pdf files) + * @throws IllegalStateException + * If data is invalid (e.g. corrupted file) and the filter have no way to recover. */ public static FilterOutput filter(Bucket data, BucketFactory bf, String typeName, URI baseURI, FoundURICallback cb) throws UnsafeContentTypeException, IOException { if(Logger.shouldLog(Logger.MINOR, ContentFilter.class)) @@ -253,7 +266,7 @@ InputStream is = null; try { byte[] data = new byte[5]; - is = bucket.getInputStream(); + is = new BufferedInputStream(bucket.getInputStream()); int read = 0; while(read < data.length) { int x; Modified: branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -21,7 +21,7 @@ public class GenericReadFilterCallback implements FilterCallback { public static final String magicHTTPEscapeString = "_CHECKED_HTTP_"; - public static final HashSet allowedProtocols; + public static final HashSet<String> allowedProtocols; static { allowedProtocols = new HashSet(); @@ -75,12 +75,28 @@ return processURI(u, overrideType, false, false); } + // RFC3986 + // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + protected static final String UNRESERVED = "[a-zA-Z0-9\\-\\._~]"; + // pct-encoded = "%" HEXDIG HEXDIG + protected static final String PCT_ENCODED = "%[0-9A-Fa-f][0-9A-Fa-f]"; + // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + // / "*" / "+" / "," / ";" / "=" + protected static final String SUB_DELIMS = "[\\!\\$&'\\(\\)\\*\\+,;=]"; + // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + protected static final String PCHAR = "(" + UNRESERVED + "|" + PCT_ENCODED + "|" + SUB_DELIMS + "|[:@])"; + // fragment = *( pchar / "/" / "?" ) + protected static final String FRAGMENT = "(" + PCHAR + "|\\/|\\?)*"; + public String processURI(String u, String overrideType, boolean noRelative, boolean inline) throws CommentException { - if(u.matches("^#[a-zA-Z0-9-_]+$")) { + if(u.matches("^#" + FRAGMENT + "$")) { // Hack for anchors, see #710 return u; } + // evil hack, see #2451 and r24565,r24566 + u = u.replaceAll(" #", " %23"); + URI uri; URI resolved; boolean logMINOR = Logger.shouldLog(Logger.MINOR, this); @@ -95,7 +111,7 @@ if(logMINOR) Logger.minor(this, "Resolved: "+resolved); } catch (URISyntaxException e1) { if(logMINOR) Logger.minor(this, "Failed to parse URI: "+e1); - throw new CommentException(l10n("couldNotParseURIWithError", "error", e1.getLocalizedMessage())); + throw new CommentException(l10n("couldNotParseURIWithError", "error", e1.getMessage())); } String path = uri.getPath(); @@ -147,7 +163,7 @@ // Not a FreenetURI if(logMINOR) Logger.minor(this, "Malformed URL (a): "+e, e); if(e.getMessage() != null) { - reason = l10n("malformedAbsoluteURL", "error", e.getLocalizedMessage()); + reason = l10n("malformedAbsoluteURL", "error", e.getMessage()); } else { reason = l10n("couldNotParseAbsoluteFreenetURI"); } @@ -172,7 +188,7 @@ } catch (MalformedURLException e) { if(logMINOR) Logger.minor(this, "Malformed URL (b): "+e, e); if(e.getMessage() != null) { - reason = l10n("malformedRelativeURL", "error", e.getLocalizedMessage()); + reason = l10n("malformedRelativeURL", "error", e.getMessage()); } else { reason = l10n("couldNotParseRelativeFreenetURI"); } @@ -225,7 +241,7 @@ } if(u.getFragment() != null) { sb.append('#'); - sb.append(u.getFragment()); + sb.append(u.getRawFragment()); } URI uri = new URI(sb.toString()); Modified: branches/db4o/freenet/src/freenet/clients/http/filter/HTMLFilter.java =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/filter/HTMLFilter.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/filter/HTMLFilter.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -245,6 +245,7 @@ } break; case INTAGQUOTES : + // Inside double-quotes, single quotes are just another character, perfectly legal in a URL. if (c == '"') { mode = INTAG; b.append(c); // Part of the element @@ -310,6 +311,9 @@ b.append(c); } else if (c == '\'') { // e.g. <div align = 'center'> (avian) + // This will be converted automatically to double quotes \" + // Note that SINGLE QUOTES ARE LEGAL IN URLS ... + // If we have single quotes inside single quotes, we could get into a major mess here... but that's really malformed code, and it will still be safe, it will just be unreadable. mode = INTAGSQUOTES; b.append(c); } else if (c == '>') { Modified: branches/db4o/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css =================================================================== --- branches/db4o/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css 2009-01-22 18:57:06 UTC (rev 25219) @@ -87,14 +87,17 @@ } #navbar ul { - margin: 0 0 0 30px; + margin: 0 0 0 10px; padding: 0; } #navbar li { - margin: 0; - padding: 0; + padding-left: 3px; + padding-right: 3px; list-style-type: none; + margin-top: 2px; + margin-bottom: 2px; + border: 2px outset #d0d0d0; } #navbar a { Modified: branches/db4o/freenet/src/freenet/crypt/Util.java =================================================================== --- branches/db4o/freenet/src/freenet/crypt/Util.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/crypt/Util.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -231,7 +231,7 @@ return (BlockCipher) Loader.getInstance( "freenet.crypt.ciphers." + name, new Class<?>[] { Integer.class }, - new Object[] { new Integer(keySize)}); + new Object[] { Integer.valueOf(keySize)}); } catch (Exception e) { //throw new UnsupportedCipherException(""+e); e.printStackTrace(); Modified: branches/db4o/freenet/src/freenet/crypt/Yarrow.java =================================================================== --- branches/db4o/freenet/src/freenet/crypt/Yarrow.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/crypt/Yarrow.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -211,6 +211,7 @@ protected void readStartupEntropy(EntropySource startupEntropy) { // Consume the current time acceptEntropy(startupEntropy, System.currentTimeMillis(), 0); + acceptEntropy(startupEntropy, System.nanoTime(), 0); // Free memory acceptEntropy(startupEntropy, Runtime.getRuntime().freeMemory(), 0); // Total memory @@ -502,9 +503,9 @@ if(source != null) { Integer contributedEntropy = entropySeen.get(source); if(contributedEntropy == null) - contributedEntropy = new Integer(actualEntropy); + contributedEntropy = Integer.valueOf(actualEntropy); else - contributedEntropy = new Integer(actualEntropy + contributedEntropy.intValue()); + contributedEntropy = Integer.valueOf(actualEntropy + contributedEntropy.intValue()); entropySeen.put(source, contributedEntropy); if(slow_entropy >= (SLOW_THRESHOLD * 2)) { Modified: branches/db4o/freenet/src/freenet/io/comm/Message.java =================================================================== --- branches/db4o/freenet/src/freenet/io/comm/Message.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/comm/Message.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -62,7 +62,7 @@ boolean logMINOR = Logger.shouldLog(Logger.MINOR, Message.class); MessageType mspec; try { - mspec = MessageType.getSpec(new Integer(bb.readInt())); + mspec = MessageType.getSpec(Integer.valueOf(bb.readInt())); } catch (IOException e1) { if(Logger.shouldLog(Logger.DEBUG, Message.class)) Logger.minor(Message.class,"Failed to read message type: "+e1, e1); @@ -177,19 +177,19 @@ } public void set(String key, byte b) { - set(key, new Byte(b)); + set(key, Byte.valueOf(b)); } public void set(String key, short s) { - set(key, new Short(s)); + set(key, Short.valueOf(s)); } public void set(String key, int i) { - set(key, new Integer(i)); + set(key, Integer.valueOf(i)); } public void set(String key, long l) { - set(key, new Long(l)); + set(key, Long.valueOf(l)); } public void set(String key, double d) { Modified: branches/db4o/freenet/src/freenet/io/comm/MessageCore.java =================================================================== --- branches/db4o/freenet/src/freenet/io/comm/MessageCore.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/comm/MessageCore.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -522,9 +522,9 @@ String messageName = m.getSpec().getName(); Integer messageCount = messageCounts.get(messageName); if (messageCount == null) { - messageCounts.put(messageName, new Integer(1) ); + messageCounts.put(messageName, Integer.valueOf(1) ); } else { - messageCount = new Integer(messageCount.intValue() + 1); + messageCount = Integer.valueOf(messageCount.intValue() + 1); messageCounts.put(messageName, messageCount ); } } Modified: branches/db4o/freenet/src/freenet/io/comm/MessageFilter.java =================================================================== --- branches/db4o/freenet/src/freenet/io/comm/MessageFilter.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/comm/MessageFilter.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -135,19 +135,19 @@ } public MessageFilter setField(String fieldName, byte value) { - return setField(fieldName, new Byte(value)); + return setField(fieldName, Byte.valueOf(value)); } public MessageFilter setField(String fieldName, short value) { - return setField(fieldName, new Short(value)); + return setField(fieldName, Short.valueOf(value)); } public MessageFilter setField(String fieldName, int value) { - return setField(fieldName, new Integer(value)); + return setField(fieldName, Integer.valueOf(value)); } public MessageFilter setField(String fieldName, long value) { - return setField(fieldName, new Long(value)); + return setField(fieldName, Long.valueOf(value)); } public MessageFilter setField(String fieldName, Object fieldValue) { Modified: branches/db4o/freenet/src/freenet/io/comm/MessageType.java =================================================================== --- branches/db4o/freenet/src/freenet/io/comm/MessageType.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/comm/MessageType.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -51,7 +51,7 @@ _name = name; this.priority = priority; internalOnly = internal; - Integer id = new Integer(name.hashCode()); + Integer id = Integer.valueOf(name.hashCode()); if (_specs.containsKey(id)) { throw new RuntimeException("A message type by the name of " + name + " already exists!"); } @@ -59,7 +59,7 @@ } public void unregister() { - _specs.remove(new Integer(_name.hashCode())); + _specs.remove(Integer.valueOf(_name.hashCode())); } public void addLinkedListField(String name, Class<?> parameter) { Modified: branches/db4o/freenet/src/freenet/io/comm/PeerContext.java =================================================================== --- branches/db4o/freenet/src/freenet/io/comm/PeerContext.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/comm/PeerContext.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -59,4 +59,7 @@ /** Compact toString() */ String shortToString(); + + /** Report a transfer failure */ + void transferFailed(String reason); } Modified: branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java =================================================================== --- branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -40,6 +40,8 @@ public static final int CANCELLED_BY_RECEIVER = 9; public static final int RECEIVER_DIED = 11; public static final int UNABLE_TO_SEND_BLOCK_WITHIN_TIMEOUT = 12; + public static final int GONE_TO_TURTLE_MODE = 13; + public static final int TURTLE_KILLED = 14; int _reason; String _cause; @@ -62,7 +64,7 @@ @Override public String toString() { - return _cause; + return getErrString(_reason)+":"+_cause; } public static String getErrString(int reason) { @@ -87,6 +89,10 @@ return "UNKNOWN"; case UNABLE_TO_SEND_BLOCK_WITHIN_TIMEOUT: return "UNABLE_TO_SEND_BLOCK_WITHIN_TIMEOUT"; + case GONE_TO_TURTLE_MODE: + return "GONE_TO_TURTLE_MODE"; + case TURTLE_KILLED: + return "TURTLE_KILLED"; default: return "UNKNOWN ("+reason+")"; } Modified: branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java =================================================================== --- branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -31,9 +31,12 @@ import freenet.io.comm.NotConnectedException; import freenet.io.comm.PeerContext; import freenet.io.comm.RetrievalException; +import freenet.node.Ticker; import freenet.support.BitArray; import freenet.support.Buffer; import freenet.support.Logger; +import freenet.support.math.MedianMeanRunningAverage; +import freenet.support.math.TrivialRunningAverage; /** * @author ian @@ -51,6 +54,8 @@ public static final int MAX_CONSECUTIVE_MISSING_PACKET_REPORTS = 4; public static final int MAX_SEND_INTERVAL = 500; public static final int CLEANUP_TIMEOUT = 5000; + // After 15 seconds, the receive is overdue and will cause backoff. + public static final int TOO_LONG_TIMEOUT = 15000; PartiallyReceivedBlock _prb; PeerContext _sender; long _uid; @@ -58,18 +63,23 @@ /** packet : Integer -> reportTime : Long * */ HashMap<Integer, Long> _recentlyReportedMissingPackets = new HashMap<Integer, Long>(); ByteCounter _ctr; + Ticker _ticker; boolean sentAborted; private MessageFilter discardFilter; private long discardEndTime; + private boolean senderAborted; +// private final boolean _doTooLong; boolean logMINOR=Logger.shouldLog(Logger.MINOR, this); - public BlockReceiver(MessageCore usm, PeerContext sender, long uid, PartiallyReceivedBlock prb, ByteCounter ctr) { + public BlockReceiver(MessageCore usm, PeerContext sender, long uid, PartiallyReceivedBlock prb, ByteCounter ctr, Ticker ticker, boolean doTooLong) { _sender = sender; _prb = prb; _uid = uid; _usm = usm; _ctr = ctr; + _ticker = ticker; +// _doTooLong = doTooLong; } public void sendAborted(int reason, String desc) throws NotConnectedException { @@ -78,6 +88,26 @@ } public byte[] receive() throws RetrievalException { + long startTime = System.currentTimeMillis(); +// if(_doTooLong) { +// _ticker.queueTimedJob(new Runnable() { +// +// public void run() { +// if(!_sender.isConnected()) return; +// try { +// if(_prb.allReceived()) return; +// } catch (AbortedException e) { +// return; +// } +// Logger.error(this, "Transfer took too long: "+_uid+" from "+_sender); +// synchronized(BlockReceiver.this) { +// tookTooLong = true; +// } +// _sender.transferFailed("Took too long (still running)"); +// } +// +// }, TOO_LONG_TIMEOUT); +// } int consecutiveMissingPacketReports = 0; try { MessageFilter mfPacketTransmit = MessageFilter.create().setTimeout(RECEIPT_TIMEOUT).setType(DMT.packetTransmit).setField(DMT.UID, _uid).setSource(_sender); @@ -101,6 +131,9 @@ if (desc.indexOf("Upstream")<0) desc="Upstream transmit error: "+desc; _prb.abort(m1.getInt(DMT.REASON), desc); + synchronized(this) { + senderAborted = true; + } throw new RetrievalException(m1.getInt(DMT.REASON), desc); } if ((m1 != null) && (m1.getSpec().equals(DMT.packetTransmit))) { @@ -111,7 +144,7 @@ Buffer data = (Buffer) m1.getObject(DMT.DATA); _prb.addPacket(packetNo, data); // Remove it from rrmp if its in there - _recentlyReportedMissingPackets.remove(new Integer(packetNo)); + _recentlyReportedMissingPackets.remove(Integer.valueOf(packetNo)); // Check that we have what the sender thinks we have LinkedList<Integer> missing = new LinkedList<Integer>(); for (int x = 0; x < sent.getSize(); x++) { @@ -165,6 +198,15 @@ discardEndTime=System.currentTimeMillis()+CLEANUP_TIMEOUT; discardFilter=relevantMessages; maybeResetDiscardFilter(); + long endTime = System.currentTimeMillis(); + long transferTime = (endTime - startTime); + if(logMINOR) { + synchronized(avgTimeTaken) { + avgTimeTaken.report(transferTime); + Logger.minor(this, "Block transfer took "+transferTime+"ms - average is "+avgTimeTaken); + } + } + return _prb.getBlock(); } catch(NotConnectedException e) { throw new RetrievalException(RetrievalException.SENDER_DISCONNECTED); @@ -183,6 +225,8 @@ } } + private static MedianMeanRunningAverage avgTimeTaken = new MedianMeanRunningAverage(); + private void maybeResetDiscardFilter() { long timeleft=discardEndTime-System.currentTimeMillis(); if (timeleft>0) { @@ -221,5 +265,8 @@ public void onRestarted(PeerContext ctx) { // Ignore } - + + public synchronized boolean senderAborted() { + return senderAborted; + } } Modified: branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java =================================================================== --- branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -36,6 +36,8 @@ import freenet.support.Logger; import freenet.support.TimeUtil; import freenet.support.io.NativeThread; +import freenet.support.math.MedianMeanRunningAverage; +import freenet.support.math.TrivialRunningAverage; /** * @author ian @@ -139,6 +141,14 @@ }; } + public void abortSend(int reason, String desc) throws NotConnectedException { + synchronized(this) { + if(_sendComplete) return; + _sendComplete = true; + } + sendAborted(reason, desc); + } + public void sendAborted(int reason, String desc) throws NotConnectedException { _usm.send(_destination, DMT.createSendAborted(_uid, reason, desc), _ctr); } @@ -152,6 +162,7 @@ } public boolean send(Executor executor) { + long startTime = System.currentTimeMillis(); PartiallyReceivedBlock.PacketReceivedListener myListener=null; try { @@ -226,6 +237,15 @@ } } } else if (msg.getSpec().equals(DMT.allReceived)) { + long endTime = System.currentTimeMillis(); + if(logMINOR) { + long transferTime = (endTime - startTime); + synchronized(avgTimeTaken) { + avgTimeTaken.report(transferTime); + Logger.minor(this, "Block send took "+transferTime+" : "+avgTimeTaken); + } + } + return true; } else if (msg.getSpec().equals(DMT.sendAborted)) { // Overloaded: receiver no longer wants the data @@ -264,6 +284,8 @@ } } + private static MedianMeanRunningAverage avgTimeTaken = new MedianMeanRunningAverage(); + public int getNumSent() { int ret = 0; for (int x=0; x<_sentPackets.getSize(); x++) { Modified: branches/db4o/freenet/src/freenet/keys/FreenetURI.java =================================================================== --- branches/db4o/freenet/src/freenet/keys/FreenetURI.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/keys/FreenetURI.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -15,6 +15,7 @@ import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; +import java.util.regex.Pattern; import com.db4o.ObjectContainer; @@ -239,20 +240,14 @@ this.suggestedEdition = suggestedEdition; } + // Strip http:// and freenet: prefix + protected final static Pattern URI_PREFIX = Pattern.compile("^(http://[^/]+/+)?(freenet:)?"); + public FreenetURI(String URI) throws MalformedURLException { if(URI == null) throw new MalformedURLException("No URI specified"); - else - URI = URI.trim(); - - if(URI.startsWith("freenet:")) - URI = URI.substring("freenet:".length()); - - // Strip any leading / - while(URI.startsWith("/")) { - URI = URI.substring(1); - } - + + URI = URI.trim(); if(URI.indexOf('@') < 0 || URI.indexOf('/') < 0) // Encoded URL? try { @@ -260,23 +255,26 @@ } catch(URLEncodedFormatException e) { throw new MalformedURLException("Invalid URI: no @ or /, or @ or / is escaped but there are invalid escapes"); } - - // Strip http:// prefix - URI = URI.replaceFirst("^http://[^/]+/+", ""); - + + URI = URI_PREFIX.matcher(URI).replaceFirst(""); + // decode keyType int atchar = URI.indexOf('@'); if(atchar == -1) throw new MalformedURLException("There is no @ in that URI! (" + URI + ')'); - else - keyType = URI.substring(0, atchar).toUpperCase().trim().intern(); + + String _keyType = URI.substring(0, atchar).toUpperCase(); URI = URI.substring(atchar + 1); - + boolean validKeyType = false; for(int i = 0; i < VALID_KEY_TYPES.length; i++) { - if(keyType.equals(VALID_KEY_TYPES[i])) + if (_keyType.equals(VALID_KEY_TYPES[i])) { validKeyType = true; + _keyType = VALID_KEY_TYPES[i]; + break; + } } + keyType = _keyType; if(!validKeyType) throw new MalformedURLException("Invalid key type: " + keyType); @@ -284,10 +282,10 @@ ArrayList<String> sv = null; int slash2; sv = new ArrayList<String>(); - while((slash2 = URI.lastIndexOf("/")) != -1) { + while ((slash2 = URI.lastIndexOf('/')) != -1) { String s; try { - s = URLDecoder.decode(URI.substring(slash2 + "/".length()), true); + s = URLDecoder.decode(URI.substring(slash2 + 1 /* "/".length() */), true); } catch(URLEncodedFormatException e) { MalformedURLException ue = new MalformedURLException(e.toString()); ue.initCause(e); @@ -545,13 +543,23 @@ suggestedEdition); } + protected String toStringCache; + @Override public String toString() { - return toString(false, false); + if (toStringCache == null) + toStringCache = toString(false, false); + return toStringCache; } - // FIXME: remove the typo in the function name. - public String toACIIString() { + /** + * @deprecated Use {@link #toASCIIString()} instead + */ + public String toACIIString() { + return toASCIIString(); + } + + public String toASCIIString() { return toString(true, true); } @@ -890,4 +898,4 @@ return new FreenetURI("USK", siteName, metaStr, routingKey, cryptoKey, extra, edition); } -} \ No newline at end of file +} Modified: branches/db4o/freenet/src/freenet/keys/USK.java =================================================================== --- branches/db4o/freenet/src/freenet/keys/USK.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/keys/USK.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -61,7 +61,7 @@ } public static USK create(FreenetURI uri) throws MalformedURLException { - if((uri.getKeyType() == null) || !(uri.getKeyType().equals("USK"))) throw new MalformedURLException("Not a USK"); + if(!uri.isUSK()) throw new MalformedURLException("Not a USK"); return new USK(uri.getRoutingKey(), uri.getCryptoKey(), uri.getExtra(), uri.getDocName(), uri.getSuggestedEdition()); } Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties =================================================================== --- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties 2009-01-22 18:57:06 UTC (rev 25219) @@ -251,6 +251,8 @@ ExtOldAgeUserAlert.extTooOld=Ihre freenet-ext.jar-Datei scheint veraltet zu sein: wir raten Ihnen dringend, Sie mit dieser http://downloads.freenetproject.org/alpha/freenet-ext.jar zu aktualisieren. ExtOldAgeUserAlert.extTooOldShort=Ihre freenet-ext.jar ist nicht mehr aktuell. Bitte aktualisieren Sie sie. ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext ist zu alt +FNPPacketMangler.somePeersDisconnectedStillNotAcked=Wahrscheinlich ein Bug, bitte weiterleiten: Verbindung zu ${count}Partnern wurde zwangsweise beendet, da sie Pakete nicht best?tigt haben. +FNPPacketMangler.somePeersDisconnectedStillNotAckedDetail=${count} ihrer Partner haben ernsthafte Probleme (best?tigen keine Pakete innerhalb von 10 Minuten). Dies ist wahrscheinlich ein Fehler im Code. Bitte informieren sie ?ber unseren Bugsammler auf ${link}https://bugs.freenetproject.org/${/link} oder ?ber die Support-Mailingliste support at freenetproject.org. Bitte schreiben sie in der Nachricht auch, welche Version von Freenet sie laufen haben. Die betroffenen Nachbarknoten (sie sollten sie m?glicherweise nicht mitteilen, wenn es Freunde sind) sind: FProxyToadlet.abortToHomepage=Abbrechen und zur FProxy-Startseite zur?ckkehren FProxyToadlet.alerts=Ausf?hrliche Status-Meldungen FProxyToadlet.alertsTitle=Warnungen @@ -276,6 +278,7 @@ FProxyToadlet.friendsTitle=Freunde FProxyToadlet.goBack=Zur?ck FProxyToadlet.goBackToPrev=Zur?ck zur vorherigen Seite +FProxyToadlet.help=Hilfe FProxyToadlet.invalidKeyTitle=Ung?ltiger Schl?ssel FProxyToadlet.invalidKeyWithReason=Ung?ltiger Schl?ssel: ${reason} FProxyToadlet.largeFile=Gro?e Datei @@ -430,6 +433,8 @@ FirstTimeWizardToadlet.connectToStrangersLong=Um Freenet zu benutzen m?ssen Sie sich mit mindestens f?nf anderen Knoten verbinden. Diese sollten im Idealfall von Leuten betrieben werden, die Sie kennen und denen Sie vertrauen. Wenn Sie nicht genug Leute kennen, die Freenet benutzen, k?nnen Sie sich dazu entschlie?en sich auch mit den Knoten von Fremden zu verbinden. Sich mit Fremden zu verbinden erm?glicht es jedoch anderen herauszufinden, dass Sie Freenet benutzen und birgt andere zus?tzliche Sicherheits-Risiken. Wenn Sie die Tatsache, dass Sie Freenet benutzen, geheim halten wollen, k?nnte Sie dies in Schwierigkeiten bringen. FirstTimeWizardToadlet.continue=Fortfahren FirstTimeWizardToadlet.continueEnd=Hier klicken, um anzufangen, Freenet zu benutzen! +FirstTimeWizardToadlet.currentPrefix=Aktuelle Gr??e: +FirstTimeWizardToadlet.currentSpeed=Aktuelles Limit: FirstTimeWizardToadlet.datastoreSize=Gr??e des Datenspeichers FirstTimeWizardToadlet.datastoreSizeLong=Bitte w?hlen Sie eine Gr??e f?r Ihren Datenspeicher. Der Datenspeicher verh?lt sich wie ein Zwischenspeicher (Cache); Daten f?r das Netzwerk zu speichern wird Ihnen zu einem besseren Daten-Durchsatz verhelfen, wenn Sie popul?re Dateien anfordern. Je mehr Platz Sie zur Verf?gung stellen k?nnen, desto besser ist es f?r die Gemeinschaft und desto schneller wird Ihr Knoten, besonders das Herunterladen, sein. FirstTimeWizardToadlet.enableOpennet=Es ist auch sp?ter, wenn Sie genug Freunde hinzugef?gt haben, noch m?glich die Verbindung zu Fremden auszuschalten. Sie werden dann jedoch in der Zwischenzeit bereits ein paar Informationen an Fremde preisgegeben haben. Freenet ist immer noch experimentell und wir geben keine Garantie f?r die Sicherheit. @@ -524,6 +529,8 @@ IPUndetectedUserAlert.detecting=Freenet versucht gerade Ihre externe IP-Adresse zu ermitteln. Wenn dies mehr als ein paar Minuten dauert, l?uft etwas schief... IPUndetectedUserAlert.detectingShort=Freenet versucht gerade Ihre externe IP-Adresse zu ermitteln. IPUndetectedUserAlert.detectingWithConfigLink=Freenet versucht gerade Ihre externe IP-Adresse zu ermitteln. Wenn dies mehr als ein paar Minuten dauert, dann l?uft etwas schief und Sie k?nnen die "Hinweis auf tempor?re IP-Adresse"-${link}Einstellung${/link} benutzen. +IPUndetectedUserAlert.loadDetectPlugins=Freenet kann ihre externe IP-Adresse nicht feststellen und es sind keine Plugins zum herausfinden der IP geladen. Es wird sehr schwierig f?r Freenet sein, sich mit anderen Knoten zu verbinden. Bitte gehen sie zur ${plugins}Plugins Seite${/plugins} und laden sie das UPnP- und JSTUN-Plugin. Alternativ k?nnen sie, wenn sie eine statische IP-Adresse oder eine eigenen Internetadresse besitzen, diese Freenet mitteilen, in dem sie dies unter der "IP-Adresse ?berschreiben" Option auf der ${config}Konfigurationsseite${/config} eintragen. +IPUndetectedUserAlert.noDetectorPlugins=Freenet kann ihre IP-Adresse nicht feststellen! Bitte laden sie das UPnP- und das JSTUN-Plugin! IPUndetectedUserAlert.suggestForwardPort=Es w?re auch eine gute Idee, den Port ${port} (UDP) auf ihrem Router weiterzuleiten, um es einfach zu machen sich mit ihrem Knoten zu verbinden. IPUndetectedUserAlert.suggestForwardTwoPorts=Es w?re auch eine gute Idee, die Ports ${port1} und ${port2} (UDP) auf ihrem Router weiterzuleiten, um es einfach zu machen sich mit ihrem Knoten zu verbinden. IPUndetectedUserAlert.unknownAddress=Freenet war nicht imstande Ihre IP-Adresse zu ermitteln (oder die IP-Adresse ihrer Firewall oder Ihres NAT-Ger?ts (Router)). Sie k?nnen immer noch Referenzen mit anderen Menschen austauschen, dies wird aber nur funktionieren, wenn der andere Benutzer sich nicht hinter einem NAT-Ger?t oder einer Firewall befindet. Sobald Sie sich auf diesem Weg mit einem anderen Benutzer verbunden haben, wird Freenet in der Lage sein ihre externe IP-Adresse zu ermitteln. Sie k?nnen auch ihre momentane IP-Adresse feststellen und diese Ihrem Knoten mit der "Hinweis auf tempor?re IP-Adresse"-${link}Einstellung${/link} mitteilen. @@ -713,6 +720,10 @@ Node.storeDirectory=Speicher-Verzeichnis Node.storeDirectoryLong=Name des Verzeichnisses in welchem die Speicher-Dateien platziert werden Node.storeMaxMemTooHigh=Mehr als 80% Ihres RAMs (Hauptspeichers) an BDB (Datenbank) abzugeben ist wahrscheinlich nicht das was Sie tun wollen! +Node.storePreallocate=Speicherplatz f?r Datenbank vorbelegen +Node.storeSaltHashMigrated=Migration der Datenbank abgeschlossen! Wenn sie m?chten, k?nnen sie nun die Dateien der alten Datenbank l?schen: +Node.storeSaltHashMigratedShort=Migration der Datenbank abgeschlossen! +Node.storeSaltHashResizeOnStart=Ver?ndere die Speichergr??e beim Knotenstart (Nur beim salt-hash) Node.storeSize=Speicher-Gr??e in Bytes Node.storeSizeLong=Gr??e des Speichers in Bytes. Node.storeType=Art der Speicherung (?NDERN SIE DIES NICHT) @@ -814,6 +825,7 @@ OpennetUserAlert.warningTitle=Warnung: Unsicherer Modus aktiviert: Ihr Knoten wird sich mit Fremden verbinden PNGFilter.invalidHeader=Die Datei, die Sie versucht haben abzurufen, ist keine PNG-Datei. Sie enth?lt keinen g?ltigen PNG-Header (Dateikopf). Es k?nnte sich um ein anderes Dateiformat handeln und Ihr Browser k?nnte etwas gef?hrliches damit tun, deshalb wurde sie blockiert. PNGFilter.invalidHeaderTitle=Keine PNG-Datei - ung?ltiger Header +PacketSender.somePeersDisconnectedBlockedTooLongDetail=${count} Ihrer Partner haben ernsthafte Probleme (weisen keine Paketnummer innerhalb von 10 Minuten zu). Dies ist wahrscheinlich ein Bug im Code. Bitte informieren sie ?ber unseren Bugsammler auf ${link}https://bugs.freenetproject.org/${/link} oder ?ber die Support-Mailingliste support at freenetproject.org. Bitte schreiben sie in der Nachricht auch, welche Version von Freenet sie laufen haben. Die betroffenen Nachbarknoten (sie sollten sie m?glicherweise nicht mitteilen, wenn es Freunde sind) sind: PageMaker.modeAdvanced=Erweiterte Oberfl?che PageMaker.modeAdvancedTooltip=Eine erweiterte Oberfl?che, die nur erfahrene Freenet-Benutzer und Entwickler werden benutzen m?ssen PageMaker.modeSimple=Einfache Oberfl?che @@ -858,6 +870,7 @@ PluginConfig.installDir=Plugin-Installations-Verzeichnis PluginConfig.installDirLong=Verzeichnis in dem die Plugins (Erweiterungen) installiert werden. PluginManager.cannotSetOnceLoaded=Kann die Plugin(=Erweiterungs)-Liste nicht modifizieren sobald sie geladen wurde +PluginManager.deleteFailedPluginButton=Beim n?chsten Start nicht wieder versuchen PluginManager.loadedOnStartup=Plugins die beim Start geladen werden PluginManager.loadedOnStartupLong=Klassenpfad, Name und Verzeichnis f?r Plugins (Erweiterungen) die beim Start des Knotens geladen werden sollen PluginManager.loadedPlugins=Plugins die beim Start geladen werden @@ -985,6 +998,7 @@ QueueToadlet.identifier=Bezeichnung QueueToadlet.insertAs=Einf?gen als: QueueToadlet.insertFile=Datei einf?gen +QueueToadlet.insertFileBrowseButton=Dateien durchsuchen QueueToadlet.insertFileBrowseLabel=Dateien auf dem Laufwerk durchsuchen QueueToadlet.insertFileCompressLabel=Komprimieren QueueToadlet.insertFileInsertFileLabel=Datei einf?gen @@ -1109,6 +1123,7 @@ SecurityLevels.physicalThreatLevel.name.LOW=NIEDRIG SecurityLevels.physicalThreatLevel.name.NORMAL=NORMAL ShortOption.parseError=Kann den Wert nicht als String-Array (Zeichenfolgen-Feld) erkennen: ${error} +SimpleHelpToadlet.descriptionTitle=Beschreibung SimpleToadletServer.advancedMode=Erweiterten Modus aktivieren? SimpleToadletServer.advancedModeLong=Aktiviert die standardm??ige Anzeige von erweiterten Einstellungen und Informationen in der Web-Oberfl?che. Diese Einstellung sollte in den meisten F?llen auf "nein" stehen. SimpleToadletServer.allowedFullAccess=Hosts die vollen Zugriff auf FProxy haben (Warnung lesen) @@ -1127,6 +1142,10 @@ SimpleToadletServer.cssOverrideNotInUploads=Wir k?nnen Sie diese Einstellung nicht setzen lassen: "${filename}" ist kein Verzeichnis, von welchem Uploads (Hochladen) erlaubt sind! SimpleToadletServer.doRobots=Roboter mithilfe der robots.txt ausschlie?en? SimpleToadletServer.doRobotsLong=Ob eine /robots.txt bereitgehalten werden soll, die Google, spiders, wget, usw. sagt, dass sie weggehen sollen +SimpleToadletServer.enableActivelinks=Aktivlinks aktivieren? +SimpleToadletServer.enableActivelinksLong=Soll die Freenet Startseite Icons f?r jede vorgemerkte Seite anzeigen? Die Seite wird schneller laden, wenn sie nicht die Icons anzeigt... +SimpleToadletServer.enableHistoryCloaking=Aktiviere Tarnung der History? +SimpleToadletServer.enableHistoryCloakingLong=Hindert Webseiten daran herauszufinden, welche Freesites Sie besucht haben. Wenn ja, wird das Freenet Web-Interface ein ?secureid= Parameter auf jeder Seite ben?tigen. Links von Freesites und dem Web-Interace werden diese einbinden. Freenet wird eine Datei mit dem Namen freenet.url.dat generieren, die die Start-URL mit ?secureid= enth?lt. Schalten Sie dies nur aus, wenn sie niemals denselben Browser f?r Freenet und f?r nicht-anonyme Webseiten nutzen. SimpleToadletServer.enableInlinePrefetch=Eingebettete Bilder vorladen? SimpleToadletServer.enableInlinePrefetchLong=Diese Einstellung k?nnte helfen, wenn ihr Browser nur wenige Verbindungen zum Knoten zul?sst. Es k?nnte aber auch nicht helfen. SimpleToadletServer.enableJS=Benutzung von Javascript durch FProxy aktivieren? @@ -1135,6 +1154,8 @@ SimpleToadletServer.enablePersistentConnectionsLong=Aktivieren Sie dies nicht, es sei denn, ihr Browser wurde konfiguriert, viele gleichzeitige Verbindungen zu nutzen auch wenn diese best?ndig sind. SimpleToadletServer.enabled=FProxy aktivieren? SimpleToadletServer.enabledLong=Ob FProxy und verwandte HTTP-Dienste aktiviert werden sollen +SimpleToadletServer.hasCompletedWizard=Haben Sie den Assistenten schon vollst?ndig ausgef?hrt? +SimpleToadletServer.hasCompletedWizardLong=Haben Sie den Assistenten schon vollst?ndig ausgef?hrt? Falls nein, wird fproxy Ihre Anfragen zum Assistenten weiterleiten. SimpleToadletServer.illegalCSSName=CSS-Namen d?rfen keine Schr?gstriche oder Doppelpunkte enthalten! SimpleToadletServer.panicButton=Den Alarm-Knopf anzeigen? SimpleToadletServer.panicButtonLong=Zeigt einen "Alarm-Knopf" auf der Warteschlangen-Seite an, welcher alle Anfragen ohne Nachfrage entfernt. @@ -1238,6 +1259,15 @@ Toadlet.unauthorized=Der Zugriff aus diese Seite ist Ihnen nicht gestattet. Toadlet.unauthorizedTitle=Nicht erlaubt Toadlet.yes=Ja +ToadletContextImpl.browserHistoryWarning=Sie sind einem Link gefolgt, oder haben eine URL eingegeben, ohne g?ltigen ?secureid= Parameter. Das bedeutet, dass die Anfrage ${bold} in Ihrer Browser-History ist${/bold}, und von jeder Webseite, die Sie besuchen, ausgelesen werden k?nnte! +ToadletContextImpl.browserHistoryWarningBoxTitle=Warnung: M?gliches Informations-Leck! +ToadletContextImpl.browserHistoryWarningCanDisable=Wenn Sie niemals denselben Browser f?r Freenet und f?r das Web verwenden, den Privatsph?ren-Modus aktiviert haben, oder es Ihnen egal ist, dass Webseiten wissen, welche Freesites Sie besucht haben, dann k?nnen Sie diese Warnung ausschalten: +ToadletContextImpl.browserHistoryWarningDisableButton=Deaktiviere diese Warnung (LESEN SIE DIE WARNUNG ZUERST!) +ToadletContextImpl.browserHistoryWarningEmptyHistory=Bitte leeren Sie Ihre Browser-History! +ToadletContextImpl.browserHistoryWarningInvalidSecureID=Insbesondere diese Anfrage sieht kopiert von einem anderem Knoten aus. Wenn eine feindliche Seite diese URI wei?, kann sie Ihre History danach erforschen. +ToadletContextImpl.browserHistoryWarningLink=Klicken Sie ${link}hier${/link}, um zu der angefragten Seite zu gelangen. +ToadletContextImpl.browserHistoryWarningNoSecureID=Sie k?nnen eine URL direkt in die Adresszeile kopiert haben: Dies ist gef?hrlich. Bitte tun Sie das nicht, au?er Sie haben geeignete Vorsichtsma?nahmen getroffen (siehe unten). Wenn Sie einen bestimmten Freenet-Key besuchen wollen, benutzen Sie bitte das Feld "Einen Schl?ssel abrufen" auf der Startseite. +ToadletContextImpl.browserHistoryWarningTitle=Warnung: M?gliches Informations-Leck! ToadletContextImpl.cannotParseContentLength=Fehler beim Erkennen der Gr??e des Inhalts: ${error} ToadletContextImpl.cannotParseContentLengthWithError=Kann die Gr??e des Inhalts nicht verarbeiten, Fehlermeldung: ${error} ToadletContextImpl.headersLineTooLong=Zeile zu lang, beim Analysieren der Header (Dateik?pfe) @@ -1352,6 +1382,8 @@ WelcomeToadlet.restartNode=Den Knoten neustarten WelcomeToadlet.restarting=Bitte warten Sie einen Moment, w?hrend der Knoten neugestartet wird. Diese Seite sollte sich automatisch aktualisieren. Danke, dass Sie Freenet benutzen. WelcomeToadlet.restartingTitle=Der Freenet-Knoten wird neugestartet. +WelcomeToadlet.searchBoxLabel=Freenet durchsuchen (Kann eine Weile dauern) +WelcomeToadlet.searchPluginNotLoaded=Suche-Plugin nicht geladen! WelcomeToadlet.shutdown=Herunterfahren WelcomeToadlet.shutdownConfirm=Sind Sie sich sicher, dass Sie Ihren Freenet-Knoten herunterfahren wollen? WelcomeToadlet.shutdownConfirmTitle=Knoten herunterfahren Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties =================================================================== --- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties 2009-01-22 18:57:06 UTC (rev 25219) @@ -257,6 +257,10 @@ ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext too old ExtOldAgeUserAlert.extTooOldShort=Your freenet-ext.jar is out of date. Please upgrade. FirstTimeWizardToadlet.homepageTitle=Freenet first time wizard! +FirstTimeWizardToadlet.browserWarningPageTitle=You must use a separate browser for Freenet! +FirstTimeWizardToadlet.browserWarningShort=You must use a separate browser for Freenet! +FirstTimeWizardToadlet.browserWarning=We ${bold}strongly${/bold} recommend that you not use the same web browser to both browse the ordinary web and access Freenet. Browser history stealing attacks in particular may enable malicious websites to determine which Freenet-based websites ("freesites") you have recently visited, breaking your anonymity. Please use a separate browser, or at least a separate browser profile, to access the Freenet web interface. +FirstTimeWizardToadlet.browserWarningSuggestion=Most web browsers, apart from Microsoft Internet Explorer (which has some issues with content type detection which are difficult to work around), will work adequately with Freenet, for example Firefox, Opera, Safari, and Lynx are known to work. You should install one of these, or create a new profile in your existing browser, then copy the current URL from the location bar, and open it in your new browser. FirstTimeWizardToadlet.chooseNodeName=Node name required! FirstTimeWizardToadlet.chooseNodeNameLong=Please enter a node name in the field below (we recommend a nickname possibly with an email address). This is so that your friends (trusted peers, which you have manually added) can easily tell your node from their other nodes. This is not visible to strangers (untrusted automatically added peers). Note that any friend or stranger may trivially identify you from your IP address, since you are connected to them, but they cannot easily tell what you are requesting. FirstTimeWizardToadlet.connectToStrangers=Connect to strangers? @@ -331,6 +335,7 @@ FProxyToadlet.friendsTitle=Connections to friends FProxyToadlet.goBack=Go back FProxyToadlet.goBackToPrev=Go back to the previous page +FProxyToadlet.help=Help FProxyToadlet.invalidKeyTitle=Invalid Key FProxyToadlet.invalidKeyWithReason=Invalid key: ${reason} FProxyToadlet.largeFile=Large file @@ -1119,6 +1124,14 @@ SecurityLevels.userAlertExtro=You can change these settings on ${link}the config page${/link}. ShortOption.parseError=Cannot parse value as a string array: ${error} ShortOption.parseError=The value specified can't be parsed as a 16-bit integer : ${val} +SimpleHelpToadlet.CHK=CHK = Content Hash Key - A static key derived by a mathematical hash of a file. +SimpleHelpToadlet.SSK=SSK = Signed Subspace Key - +SimpleHelpToadlet.USK=USK = Updateable Subspace Key - +SimpleHelpToadlet.connectivityText=Testing. Test. Blah blah blah, etc etc etc +SimpleHelpToadlet.connectivityTitle=Connectivity +SimpleHelpToadlet.definitionsTitle=Definitions +SimpleHelpToadlet.descriptionText=This page should provide basic info for you to get started with Freenet. There are many other places for more in-depth information such as the offical Freenet website http://freenetproject.org, the offical wiki http://wiki.freenetproject.org or various in-Freenet Freesites. +SimpleHelpToadlet.descriptionTitle=Description SimpleToadletServer.advancedMode=Enable Advanced Mode? SimpleToadletServer.advancedModeLong=Enables display of advanced options and information in the web interface by default. This setting should be turned to false in most cases. SimpleToadletServer.allowedFullAccess=Hosts having a full access to FProxy (read warning) @@ -1137,6 +1150,8 @@ SimpleToadletServer.cssOverrideNotInUploads=We can't let you set that setting: "${filename} isn't in a directory from which uploads are allowed! SimpleToadletServer.doRobots=Exclude robots via robots.txt? SimpleToadletServer.doRobotsLong=Whether to serve a /robots.txt telling google, spiders, wget, etc to go away +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.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? @@ -1222,7 +1237,7 @@ StatisticsToadlet.requestOutput=Request output (excluding payload): CHK ${chk} SSK ${ssk}. StatisticsToadlet.totalInput=Total Input: ${total} (${rate}/sec) StatisticsToadlet.totalOutput=Total Output: ${total} (${rate}/sec) -StatisticsToadlet.transferringRequests=Transferring Requests: sending ${senders}, receiving ${receivers} +StatisticsToadlet.transferringRequests=Transferring Requests: sending ${senders}, receiving ${receivers}, receiving turtles ${turtles} StatisticsToadlet.uomBytes=Updater Output: ${total} StatisticsToadlet.unaccountedBytes=Other output: ${total} (${percent}%) StatisticsToadlet.usedMemory=Used Java memory: ${memory} @@ -1325,7 +1340,7 @@ UserAlert.apply=Apply UserAlert.hide=Hide UserAlert.reset=Reset -UserAlertManager.alertsOnAlertsPage= | See them on ${link}the alerts page${/link}. +UserAlertManager.alertsOnAlertsPage=| See them on ${link}the alerts page${/link}. UserAlertManager.alertsTitle=Outstanding alerts UserAlertManager.clickForMore=Click on an item for more information or to get rid of it. UserAlertManager.criticalErrorCountLabel=Critical Errors: @@ -1351,7 +1366,7 @@ WelcomeToadlet.extVersion=Freenet-ext Build #${build} r${rev} WelcomeToadlet.extVersionWithRecommended=Freenet-ext Build #${build} (${recbuild} is recommended) r${rev} WelcomeToadlet.fetch=Fetch -WelcomeToadlet.fetchKeyLabel=Fetch a Key +WelcomeToadlet.fetchKeyLabel=Fetch a Key (CHK, SSK, USK) WelcomeToadlet.finInsertSuccessWithKey=The message has been inserted successfully into ${key}. WelcomeToadlet.finInsertedTitle=Insertion WelcomeToadlet.finTitle=Frost Instant Note insert @@ -1380,6 +1395,8 @@ WelcomeToadlet.restartNode=Restart the node WelcomeToadlet.restarting=Please wait a moment while the node is being restarted. This screen should refresh automatically. Thank you for using Freenet. WelcomeToadlet.restartingTitle=The Freenet node is being restarted. +WelcomeToadlet.searchBoxLabel=Search Freenet (may take a while) +WelcomeToadlet.searchPluginNotLoaded=Search plugin not loaded! WelcomeToadlet.shutdown=Shutdown WelcomeToadlet.shutdownConfirm=Are you sure you wish to shut down your Freenet node? WelcomeToadlet.shutdownConfirmTitle=Node Shutdown Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties =================================================================== --- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties 2009-01-22 18:57:06 UTC (rev 25219) @@ -256,6 +256,8 @@ ExtOldAgeUserAlert.extTooOld=Votre fichier freenet-ext.jar semble trop ancien : vous devriez le mettre ? jour depuis http://downloads.freenetproject.org/alpha/freenet-ext.jar. ExtOldAgeUserAlert.extTooOldShort=Votre freenet-ext.jar est ancien. Veuillez mettre ? jour. ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext trop ancien +FNPPacketMangler.somePeersDisconnectedStillNotAcked=Probablement un bug : veuillez faire le rapport suivant : ${count} noeuds ont ?t? d?connect? de force car les donn?es ne sont pas reconnues. +FNPPacketMangler.somePeersDisconnectedStillNotAckedDetail=${count} des noeuds auxquels vous ?tes connect?s ont de s?rieux probl?mes (donn?es non reconnues m?me apr?s 10 minutes). Ceci est probablement d? a un bug dans le code. Veuillez svp nous faire un rapport en utilisant le gestionnaire de bug ? l'adresse suivante : ${link}https://bugs.freenetproject.org/${/link} ou sur la mailing de support support at freenetproject.org. Veuillez indiquer ce message et la version utilis? par votre noeud. Les noeuds concern?s (vous pouvez ne pas vouloir inclure ceux connect?s en darknet) sont : FProxyToadlet.abortToHomepage=Annuler et revenir ? la page d'accueil FProxyToadlet.alerts=messages d?taill?s et messages de vos Amis FProxyToadlet.alertsTitle=Messages @@ -281,6 +283,7 @@ FProxyToadlet.friendsTitle=Connexions aux Amis FProxyToadlet.goBack=Retour FProxyToadlet.goBackToPrev=Revenir ? la page pr?c?dente +FProxyToadlet.help=Aide FProxyToadlet.invalidKeyTitle=Cl? invalide FProxyToadlet.invalidKeyWithReason=Cl? invalide : ${reason} FProxyToadlet.largeFile=Grand fichier @@ -735,6 +738,8 @@ Node.storeMaxMemTooHigh=Vous ne voulez s?rement pas donner plus de 80% de votre m?moire ? BDB ! Node.storePreallocate=Pr?allouer l'espace pour le datastore Node.storePreallocateLong=Pr?allouer l'espace du datastore +Node.storeSaltHashMigrated=La migration du datastore est termin?e ! Vous pouvez maintenant effacer les fichiers de l'ancien datastore: +Node.storeSaltHashMigratedShort=La migration du datastore est termin?e ! Node.storeSaltHashResizeOnStart=Redimentionner le store au d?marrage (salt-hash uniquement) Node.storeSaltHashResizeOnStartLong=Redimentionner le store au d?marrage du noeud (salt-hash uniquement). Si activ?, le noeud terminera le redimentionnement pendant le d?marrage. C'est beaucoup plus rapide que de le faire "? chaud", maid le noeud ne sera pas disponnible avant un moment. Node.storeSize=Taille du store en octets @@ -1141,6 +1146,8 @@ SecurityLevels.physicalThreatLevel.name.LOW=BAS SecurityLevels.physicalThreatLevel.name.NORMAL=NORMAL ShortOption.parseError=Cette valeur n'est pas un entier sur 16 bits : ${val} +SimpleHelpToadlet.definitionsTitle=D?finitions +SimpleHelpToadlet.descriptionTitle=Description SimpleToadletServer.advancedMode=Activer le mode avanc? ? SimpleToadletServer.advancedModeLong=Active l'affichage des options et des informations avanc?es dans l'interface web par d?faut. Ce param?tre devrait ?tre d?sactiv? dans la plupart des cas. SimpleToadletServer.allowedFullAccess=Machines ayant un acc?s complet ? FProxy (lire l'avertissement) @@ -1275,6 +1282,10 @@ Toadlet.unauthorized=Vous n'?tes pas autoris? ? acc?der ? cette page. Toadlet.unauthorizedTitle=Acc?s refus? Toadlet.yes=Oui +ToadletContextImpl.browserHistoryWarningBoxTitle=Attention : fuite d'information possible ! +ToadletContextImpl.browserHistoryWarningDisableButton=D?sactiver cet avertissement (LISEZ L'AVERTISSEMENT AVANT !) +ToadletContextImpl.browserHistoryWarningEmptyHistory=Videz l'historique de votre navigateur s'il vous plait ! +ToadletContextImpl.browserHistoryWarningTitle=Attention : fuite d'information possible ! ToadletContextImpl.cannotParseContentLength=Erreur de content-length : ${error} ToadletContextImpl.cannotParseContentLengthWithError=Impossible de traiter le content-length: ${error} ToadletContextImpl.headersLineTooLong=L'analyse des en-t?tes a rencontr? une ligne trop longue @@ -1389,6 +1400,7 @@ WelcomeToadlet.restartNode=Red?marrer le noeud WelcomeToadlet.restarting=Veuillez patienter pendant le red?marrage du n?ud. Cet ?cran se rafraichira automatiquement. Merci d'utiliser Freenet. WelcomeToadlet.restartingTitle=Le noeud est en train de red?marrer. +WelcomeToadlet.searchBoxLabel=Chercher sur Freenet (pourrait prendre un certain temps) WelcomeToadlet.shutdown=Eteindre WelcomeToadlet.shutdownConfirm=Etes-vous s?r de vouloir arr?ter le noeud Freenet ? WelcomeToadlet.shutdownConfirmTitle=Arr?t du noeud Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties =================================================================== --- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties 2009-01-22 18:57:06 UTC (rev 25219) @@ -744,9 +744,9 @@ Node.publishOurPeersLocationLong=Trasmettere ai peer la locazione dei nostri peer? Ci? facilita il routing ma fornisce informazioni ad un potenziale avversario. Node.routeAccordingToOurPeersLocation=Utilizza la locazione dei peer dei nostri peer per il routing Node.routeAccordingToOurPeersLocationLong=Usare per il routing la locazione dei peer dei nostri peer? Ci? facilita il routing ma potrebbe essere utile ad un potenziale avversario. -Node.storeBloomFilterCounting=Usa counting bloom filter -Node.storeBloomFilterCountingLong=Usare counting bloom filter a 2 bit? (in caso di dubbio, non modificare) -Node.storeBloomFilterSize=Dimensione del bloom filter (totale) in bytes +Node.storeBloomFilterCounting=Usa filtro counting bloom +Node.storeBloomFilterCountingLong=Usare filtro bloom con contatore a 2 bit? (in caso di dubbio, non modificare) +Node.storeBloomFilterSize=Dimensione del filtro bloom (totale) in bytes Node.storeBloomFilterSizeLong=Dimensioni del filtro bloom in bytes. Di solito 1/2048mo della dimensione del datastore ? pi? che abbastanza. Impostare su zero per disabilitare il bloom filter. Impostare su -1 per tornare al default. Node.storeDirectory=Directory magazzino dati (store) Node.storeDirectoryLong=Directory contenente gli store file @@ -760,7 +760,7 @@ Node.storeSize=Dimensioni in bytes del magazzino dati (store) Node.storeSizeLong=Dimensioni del magazzino (store) in bytes Node.storeType=Tipo di magazzino dati (store). NON MODIFICARE!! -Node.storeTypeLong=Al momento sono disponibili i seguenti tipi di datastore: salt-hash (SPERIMENTALE, usa salted hashtable su dico con bloom filter); bdb-index (STABILE, usa BerkeleyDBFreenetStore per immagazzinare l'indice e tiene i dati su disco) o ram (SOLO PER TESTING, tiene sia indice che dati su RAM). Usare ram solo se competenti e se ? disponibile memoria sufficiente per immagazzinare tutti i dati (NOTA: i dati NON verranno salvati quando il nodo viene spento). I cambiamenti verranno attivati al riavvio di Freenet. +Node.storeTypeLong=Al momento sono disponibili i seguenti tipi di datastore: salt-hash (SPERIMENTALE, usa salted hash table su disco con bloom filter); bdb-index (STABILE, usa BerkeleyDBFreenetStore per immagazzinare l'indice e tiene i dati su disco) o ram (SOLO PER TESTING, tiene sia indice che dati su RAM). Usare ram solo se competenti e se ? disponibile memoria sufficiente per immagazzinare tutti i dati (NOTA: i dati NON verranno salvati quando il nodo viene spento). I cambiamenti verranno attivati al riavvio di Freenet. Node.swapRInterval=Intervallo tra le richieste di scambio (swap) in millisecondi Node.swapRIntervalLong=Intervallo tra richieste di scambio (swap) in millisecondi. Non modificare! Node.throttleLocalTraffic=Limitazione di banda su traffico locale @@ -769,7 +769,7 @@ Node.tooSmallMTULong=L' MTU della connessione sembra essere ${mtu} bytes. Freenet non pu? funzionare bene con un MTU minore di ${minMTU} bytes: le connessioni saranno inaffidabili e forse rallentate. Se possibile, si dovrebbe provvedere a risolvere il problema. Node.tooSmallMTUShort=Problema di connessione: MTU di connessione troppo basso per consentire a Freenet di funzionare correttamente. Potranno verificarsi dei problemi. Node.withAnnouncement=Permetti l'auto-inserimento del nodo nella rete usando seednodes -Node.withAnnouncementLong=Permettere che il nodo si auto-inserisca nella rete Freenet usando seednodes? Questa opzione ? abilitata di default per motivi tecnici ma ? intrinsecamente insicura +Node.withAnnouncementLong=Permettere che il nodo si auto-inserisca nella rete Freenet usando seednodes? Per potersi connettere ad Opennet (rete di Sconosciuti alla quale Freenet si connette automaticamente se il livello di sicurezza ? impostato su Basso o Medio) il nodo si mette in contatto con dei nodi pubblicamente accessibili che sceglie da una breve lista distribuita con Freenet. Ovviamente la sicurezza di una connessione di questo tipo sar? meno che ottimale, ma chi usa Opennet di solito lo fa perch? non ha scelta: se un nodo resta disconnesso per un po' di tempo, specialmente se ? dietro NAT e/o se cambia spesso IP, probabilmente avr? bisogno del reseed. Per ottenere un livello di sicurezza pi? alto ? necessario connettersi a nodi gestiti da amici ed abilitare il livello di sicurezza in rete Alto. NodeClientCore.couldNotFindOrCreateDir=Non ? stato possibile trovare o creare la directory NodeClientCore.downloadAllowedDirs=Directory dove il download ? consentito NodeClientCore.downloadAllowedDirsLong=Si pu? usare una lista di directory dove dove il download e' permesso, separate da 'punto e virgola' (;). "downloads" significa downloadsDir, vuoto (nessuna directory specificata) significa che il download su disco non e' permesso, "all" significa download permessi in tutte le directory AVVERTENZA; Se impostato su "all" ("tutte"), ogni utente potr? scaricare file in qualsiasi directory. @@ -1003,7 +1003,7 @@ QueueToadlet.downloadSucceededTitle=Download completato: ${filename} QueueToadlet.emergency=urgenza estrema QueueToadlet.enqueuedFailure=Non ? stato possibile agguingere alla coda le ${number} chiavi qui elencate: -QueueToadlet.enqueuedSuccessfully=Le ${number} chiavi elencate di seguito sono state aggiunte alla coda con successo: +QueueToadlet.enqueuedSuccessfully=Aggiunte alla coda dei download ${number} chiavi elencate di seguito: QueueToadlet.errorAccessDenied=Errore: Accesso Negato QueueToadlet.errorAccessDeniedFile=L'attuale configurazione del nodo non consente l'upload del file "${file}". QueueToadlet.errorDToDisk=Non ? stato possibile scaricare su disco @@ -1205,6 +1205,8 @@ SimpleToadletServer.passthroughMaxSizeLong=Dimensione massima di un file per pass-through trasparente in FProxy. SimpleToadletServer.port=Numero della porta FProxy SimpleToadletServer.portLong=Numero della porta FProxy +SimpleToadletServer.publicGatewayMode=Modalit? gateway pubblico (Ha effetto solo sulle connessioni autorizzate ma senza accesso pieno) +SimpleToadletServer.publicGatewayModeLong=Abilita modalit? gteway pubblico? Per gli indirizzi IP con accesso al nodo autorizzato ma non pieno, questa opzione disabilita l'accesso alla coda dei download ed a tutte le operazioni di cui ci si potrebbe servire per attaccare il nodo, ma continuando a permettere la navigazione su freesite. Agli indirizzi IP che godono di accesso pieno viene permesso di modificare la configurazione del nodo SimpleToadletServer.ssl=Abilita SSL SimpleToadletServer.sslLong=Abilitare SSL su FProxy? StartupToadlet.entropyErrorContent=Non c'? abbastanza entropia disponibile nel sistema, Freenet non potr? avviarsi finch? non ne avr? messa insieme abbastanza (soluzione: creare attivit? lanciando una ricerca su tutti i file: trova *.* su Win o find / su Mac, Linux, altri *nix) Modified: branches/db4o/freenet/src/freenet/pluginmanager/PluginHandler.java =================================================================== --- branches/db4o/freenet/src/freenet/pluginmanager/PluginHandler.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/pluginmanager/PluginHandler.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -23,6 +23,11 @@ final PluginInfoWrapper pi = new PluginInfoWrapper(pr, plug, filename); final PluginStarter ps = new PluginStarter(pr, pi); ps.setPlugin(pm, plug); + + ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); + ClassLoader pluginClassLoader = plug.getClass().getClassLoader(); + Thread.currentThread().setContextClassLoader(pluginClassLoader); + try { // We must start the plugin *after startup has finished* Runnable job; if(!pi.isThreadlessPlugin()) { @@ -40,6 +45,9 @@ plug.runPlugin(pr); pm.register(plug, pi); } + } finally { + Thread.currentThread().setContextClassLoader(oldClassLoader); + } return pi; } Modified: branches/db4o/freenet/src/freenet/pluginmanager/PluginInfoWrapper.java =================================================================== --- branches/db4o/freenet/src/freenet/pluginmanager/PluginInfoWrapper.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/pluginmanager/PluginInfoWrapper.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -4,7 +4,9 @@ import java.util.HashSet; import freenet.l10n.L10n; +import freenet.support.JarClassLoader; import freenet.support.Logger; +import freenet.support.io.Closer; public class PluginInfoWrapper { @@ -130,6 +132,13 @@ } } } + + // Close the jar file, so we may delete / reload it + ClassLoader cl = plug.getClass().getClassLoader(); + if (cl instanceof JarClassLoader) { + Closer.close((JarClassLoader) cl); + } + // always remove plugin manager.removePlugin(this); } Modified: branches/db4o/freenet/src/freenet/pluginmanager/PluginManager.java =================================================================== --- branches/db4o/freenet/src/freenet/pluginmanager/PluginManager.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/pluginmanager/PluginManager.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -529,8 +529,15 @@ return null; */ + ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); + ClassLoader pluginClassLoader = handler.getClass().getClassLoader(); + Thread.currentThread().setContextClassLoader(pluginClassLoader); + try { if(handler instanceof FredPluginHTTP) return ((FredPluginHTTP) handler).handleHTTPGet(request); + } finally { + Thread.currentThread().setContextClassLoader(oldClassLoader); + } throw new NotFoundPluginHTTPException("Plugin not found!", "/plugins"); } @@ -543,10 +550,15 @@ /*if (handler == null) return null; */ - + ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); + ClassLoader pluginClassLoader = handler.getClass().getClassLoader(); + Thread.currentThread().setContextClassLoader(pluginClassLoader); + try { if(handler instanceof FredPluginHTTP) return ((FredPluginHTTP) handler).handleHTTPPost(request); - + } finally { + Thread.currentThread().setContextClassLoader(oldClassLoader); + } throw new NotFoundPluginHTTPException("Plugin not found!", "/plugins"); } Modified: branches/db4o/freenet/src/freenet/store/BerkeleyDBFreenetStore.java =================================================================== --- branches/db4o/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -550,7 +550,7 @@ Arrays.sort(unwantedMoveNums); for(int i=0;i<newSize;i++) { - Integer ii = new Integer(i); + Integer ii = Integer.valueOf(i); if(Arrays.binarySearch(wantedKeepNums, ii) >= 0) continue; if(Arrays.binarySearch(unwantedIgnoreNums, ii) >= 0) continue; if(Arrays.binarySearch(wantedMoveNums, ii) >= 0) continue; @@ -600,7 +600,7 @@ // Can we move over an empty slot? if(i < freeEarlySlots.length) { // Don't need to delete old block - unwantedBlock = new Integer((int) freeEarlySlots[i]); // will fit in an int + unwantedBlock = Integer.valueOf((int) freeEarlySlots[i]); // will fit in an int } else if(unwantedMoveNums.length + freeEarlySlots.length > i) { unwantedBlock = unwantedMoveNums[i-freeEarlySlots.length]; // Delete unwantedBlock from the store Modified: branches/db4o/freenet/src/freenet/store/RAMFreenetStore.java =================================================================== --- branches/db4o/freenet/src/freenet/store/RAMFreenetStore.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/store/RAMFreenetStore.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -9,6 +9,11 @@ import freenet.support.ByteArrayWrapper; import freenet.support.LRUHashtable; +/** + * LRU in memory store. + * + * For debugging / simulation only + */ public class RAMFreenetStore implements FreenetStore { private final static class Block { Modified: branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java =================================================================== --- branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -47,8 +47,13 @@ import freenet.support.io.NativeThread; /** - * Index-less data store based on salted hash + * Index-less data store based on salted hash. * + * Provide a pseudo-random replacement based on a salt value generated on create. Keys are check + * against a bloom filter before probing. Data are encrypted using the route key and the salt, so + * there is no way to recover the data without holding the route key. (For debugging, you can set + * OPTION_SAVE_PLAINKEY=true in source code) + * * @author sdiz */ public class SaltedHashFreenetStore implements FreenetStore { @@ -706,6 +711,7 @@ } private void flushAndClose() { + Logger.normal(this, "Flush and closing this store: " + name); try { metaFC.force(true); metaFC.close(); Property changes on: branches/db4o/freenet/src/freenet/support/BinaryBloomFilter.java ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/freenet/src/freenet/support/BinaryBloomFilter.java:22002-24445 + /trunk/freenet/src/freenet/support/BinaryBloomFilter.java:22002-25205 Modified: branches/db4o/freenet/src/freenet/support/BloomFilter.java =================================================================== --- branches/db4o/freenet/src/freenet/support/BloomFilter.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/BloomFilter.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -202,6 +202,8 @@ if (filter != null) { force(); } + // don't trust findbug, this is not a error + // sometimes, we call finalize() manually and this serve as a flag filter = null; forkedFilter = null; } Property changes on: branches/db4o/freenet/src/freenet/support/BloomFilter.java ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/freenet/src/freenet/support/BloomFilter.java:22002-24445 + /trunk/freenet/src/freenet/support/BloomFilter.java:22002-25205 Property changes on: branches/db4o/freenet/src/freenet/support/CountingBloomFilter.java ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/freenet/src/freenet/support/CountingBloomFilter.java:22002-24445 + /trunk/freenet/src/freenet/support/CountingBloomFilter.java:22002-25205 Modified: branches/db4o/freenet/src/freenet/support/HTMLEncoder.java =================================================================== --- branches/db4o/freenet/src/freenet/support/HTMLEncoder.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/HTMLEncoder.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -14,7 +14,7 @@ public class HTMLEncoder { public final static CharTable charTable = new CharTable(HTMLEntities.encodeMap); - + public static String encode(String s) { int n = s.length(); StringBuilder sb = new StringBuilder(n); @@ -41,6 +41,28 @@ } } + + /** + * Encode String so it is safe to be used in XML attribute value and text. + * + * HTMLEncode.encode() use some HTML-specific entities (e.g. &) hence not suitable for + * generic XML. + */ + public static String encodeXML(String s) { + // Extensible Markup Language (XML) 1.0 (Fifth Edition) + // [10] AttValue ::= '"' ([^<&"] | Reference)* '"' + // | "'" ([^<&'] | Reference)* "'" + // [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) + s = s.replace("&", "&"); + + s = s.replace("\"", """); + s = s.replace("'", "'"); + + s = s.replace("<", "<"); + s = s.replace(">", ">"); // CharData can't contain ']]>' + + return s; + } private final static class CharTable{ private char[] chars; Modified: branches/db4o/freenet/src/freenet/support/HTMLNode.java =================================================================== --- branches/db4o/freenet/src/freenet/support/HTMLNode.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/HTMLNode.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -12,6 +12,7 @@ public class HTMLNode implements XMLCharacterClasses { private static final Pattern namePattern = Pattern.compile("^[" + NAME + "]*$"); + private static final Pattern simpleNamePattern = Pattern.compile("^[A-Za-z][A-Za-z0-9]*$"); protected final String name; @@ -41,8 +42,12 @@ this(name, attributeNames, attributeValues, null); } + protected boolean checkNamePattern(String str) { + return simpleNamePattern.matcher(str).matches() || namePattern.matcher(str).matches(); + } + public HTMLNode(String name, String[] attributeNames, String[] attributeValues, String content) { - if ((name == null) || (!"#".equals(name) && !"%".equals(name) && !namePattern.matcher(name).matches())) { + if ((name == null) || (!"#".equals(name) && !"%".equals(name) && !checkNamePattern(name))) { throw new IllegalArgumentException("element name is not legal"); } if ((attributeNames != null) && (attributeValues != null)) { @@ -50,7 +55,7 @@ throw new IllegalArgumentException("attribute names and values differ in length"); } for (int attributeIndex = 0, attributeCount = attributeNames.length; attributeIndex < attributeCount; attributeIndex++) { - if ((attributeNames[attributeIndex] == null) || !namePattern.matcher(attributeNames[attributeIndex]).matches()) { + if ((attributeNames[attributeIndex] == null) || !checkNamePattern(attributeNames[attributeIndex])) { throw new IllegalArgumentException("attributeName is not legal"); } addAttribute(attributeNames[attributeIndex], attributeValues[attributeIndex]); Modified: branches/db4o/freenet/src/freenet/support/JarClassLoader.java =================================================================== --- branches/db4o/freenet/src/freenet/support/JarClassLoader.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/JarClassLoader.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -19,6 +19,7 @@ package freenet.support; import java.io.ByteArrayOutputStream; +import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -38,7 +39,7 @@ * @author <a href="mailto:dr at ina-germany.de">David Roden</a> * @version $Id$ */ -public class JarClassLoader extends ClassLoader { +public class JarClassLoader extends ClassLoader implements Closeable { /** The temporary jar file. */ private JarFile tempJarFile; @@ -166,4 +167,7 @@ return name.replace('.', '/') + ".class"; } + public void close() throws IOException { + tempJarFile.close(); + } } Modified: branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java =================================================================== --- branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -176,7 +176,7 @@ } if(index == maxValue) { for(int i=maxValue;i>=minValue;i--) { - Integer ii = new Integer(i); + Integer ii = Integer.valueOf(i); if(contents.containsKey(ii)) { maxValue = i; notifyAll(); @@ -189,7 +189,7 @@ } if(index == minValue) { for(int i=minValue;i<=maxValue;i++) { - Integer ii = new Integer(i); + Integer ii = Integer.valueOf(i); if(contents.containsKey(ii)) { minValue = i; notifyAll(); Modified: branches/db4o/freenet/src/freenet/support/PooledExecutor.java =================================================================== --- branches/db4o/freenet/src/freenet/support/PooledExecutor.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/PooledExecutor.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -74,6 +74,7 @@ // Must create new thread if((!fromTicker) && NativeThread.usingNativeCode() && prio > Thread.currentThread().getPriority()) { // Run on ticker + // j16sdiz (22-Dec-2008): should we queue it? the ticker is "PacketSender", but it keep busying on non-packet related works ticker.queueTimedJob(job, jobName, 0, true); return; } Copied: branches/db4o/freenet/src/freenet/support/StringValidityChecker.java (from rev 25205, trunk/freenet/src/freenet/support/StringValidityChecker.java) =================================================================== --- branches/db4o/freenet/src/freenet/support/StringValidityChecker.java (rev 0) +++ branches/db4o/freenet/src/freenet/support/StringValidityChecker.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -0,0 +1,192 @@ +package freenet.support; + +import java.util.Arrays; +import java.util.HashSet; + +public class StringValidityChecker { + + /** + * Taken from http://kb.mozillazine.org/Network.IDN.blacklist_chars + */ + static HashSet<Character> idnBlacklist = new HashSet<Character>(Arrays.asList( + new Character[] { + 0x0020, /* SPACE */ + 0x00A0, /* NO-BREAK SPACE */ + 0x00BC, /* VULGAR FRACTION ONE QUARTER */ + 0x00BD, /* VULGAR FRACTION ONE HALF */ + 0x01C3, /* LATIN LETTER RETROFLEX CLICK */ + 0x0337, /* COMBINING SHORT SOLIDUS OVERLAY */ + 0x0338, /* COMBINING LONG SOLIDUS OVERLAY */ + 0x05C3, /* HEBREW PUNCTUATION SOF PASUQ */ + 0x05F4, /* HEBREW PUNCTUATION GERSHAYIM */ + 0x06D4, /* ARABIC FULL STOP */ + 0x0702, /* SYRIAC SUBLINEAR FULL STOP */ + 0x115F, /* HANGUL CHOSEONG FILLER */ + 0x1160, /* HANGUL JUNGSEONG FILLER */ + 0x2000, /* EN QUAD */ + 0x2001, /* EM QUAD */ + 0x2002, /* EN SPACE */ + 0x2003, /* EM SPACE */ + 0x2004, /* THREE-PER-EM SPACE */ + 0x2005, /* FOUR-PER-EM SPACE */ + 0x2006, /* SIX-PER-EM-SPACE */ + 0x2007, /* FIGURE SPACE */ + 0x2008, /* PUNCTUATION SPACE */ + 0x2009, /* THIN SPACE */ + 0x200A, /* HAIR SPACE */ + 0x200B, /* ZERO WIDTH SPACE */ + 0x2024, /* ONE DOT LEADER */ + 0x2027, /* HYPHENATION POINT */ + 0x2028, /* LINE SEPARATOR */ + 0x2029, /* PARAGRAPH SEPARATOR */ + 0x202F, /* NARROW NO-BREAK SPACE */ + 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ + 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ + 0x2044, /* FRACTION SLASH */ + 0x205F, /* MEDIUM MATHEMATICAL SPACE */ + 0x2154, /* VULGAR FRACTION TWO THIRDS */ + 0x2155, /* VULGAR FRACTION ONE FIFTH */ + 0x2156, /* VULGAR FRACTION TWO FIFTHS */ + 0x2159, /* VULGAR FRACTION ONE SIXTH */ + 0x215A, /* VULGAR FRACTION FIVE SIXTHS */ + 0x215B, /* VULGAR FRACTION ONE EIGTH */ + 0x215F, /* FRACTION NUMERATOR ONE */ + 0x2215, /* DIVISION SLASH */ + 0x23AE, /* INTEGRAL EXTENSION */ + 0x29F6, /* SOLIDUS WITH OVERBAR */ + 0x29F8, /* BIG SOLIDUS */ + 0x2AFB, /* TRIPLE SOLIDUS BINARY RELATION */ + 0x2AFD, /* DOUBLE SOLIDUS OPERATOR */ + 0x2FF0, /* IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT */ + 0x2FF1, /* IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO BELOW */ + 0x2FF2, /* IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO MIDDLE AND RIGHT */ + 0x2FF3, /* IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO MIDDLE AND BELOW */ + 0x2FF4, /* IDEOGRAPHIC DESCRIPTION CHARACTER FULL SURROUND */ + 0x2FF5, /* IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE */ + 0x2FF6, /* IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM BELOW */ + 0x2FF7, /* IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LEFT */ + 0x2FF8, /* IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER LEFT */ + 0x2FF9, /* IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER RIGHT */ + 0x2FFA, /* IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LOWER LEFT */ + 0x2FFB, /* IDEOGRAPHIC DESCRIPTION CHARACTER OVERLAID */ + 0x3000, /* IDEOGRAPHIC SPACE */ + 0x3002, /* IDEOGRAPHIC FULL STOP */ + 0x3014, /* LEFT TORTOISE SHELL BRACKET */ + 0x3015, /* RIGHT TORTOISE SHELL BRACKET */ + 0x3033, /* VERTICAL KANA REPEAT MARK UPPER HALF */ + 0x3164, /* HANGUL FILLER */ + 0x321D, /* PARENTHESIZED KOREAN CHARACTER OJEON */ + 0x321E, /* PARENTHESIZED KOREAN CHARACTER O HU */ + 0x33AE, /* SQUARE RAD OVER S */ + 0x33AF, /* SQUARE RAD OVER S SQUARED */ + 0x33C6, /* SQUARE C OVER KG */ + 0x33DF, /* SQUARE A OVER M */ + 0xFE14, /* PRESENTATION FORM FOR VERTICAL SEMICOLON */ + 0xFE15, /* PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK */ + 0xFE3F, /* PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET */ + 0xFE5D, /* SMALL LEFT TORTOISE SHELL BRACKET */ + 0xFE5E, /* SMALL RIGHT TORTOISE SHELL BRACKET */ + 0xFEFF, /* ZERO-WIDTH NO-BREAK SPACE */ + 0xFF0E, /* FULLWIDTH FULL STOP */ + 0xFF0F, /* FULL WIDTH SOLIDUS */ + 0xFF61, /* HALFWIDTH IDEOGRAPHIC FULL STOP */ + 0xFFA0, /* HALFWIDTH HANGUL FILLER */ + 0xFFF9, /* INTERLINEAR ANNOTATION ANCHOR */ + 0xFFFA, /* INTERLINEAR ANNOTATION SEPARATOR */ + 0xFFFB, /* INTERLINEAR ANNOTATION TERMINATOR */ + 0xFFFC, /* OBJECT REPLACEMENT CHARACTER */ + 0xFFFD, /* REPLACEMENT CHARACTER */ + })); + + public static boolean containsNoIDNBlacklistCharacters(String text) { + for(Character c : text.toCharArray()) { + if(idnBlacklist.contains(c)) + return false; + } + + return true; + } + + public static boolean containsNoLinebreaks(String text) { + for(Character c : text.toCharArray()) { + if(Character.getType(c) == Character.LINE_SEPARATOR + || Character.getType(c) == Character.PARAGRAPH_SEPARATOR + || c == '\n' || c == '\r') + return false; + } + + return true; + } + + /** + * Check for any values in the string that are not valid Unicode + * characters. + */ + public static boolean containsNoInvalidCharacters(String text) { + for (int i = 0; i < text.length(); ) { + int c = text.codePointAt(i); + i += Character.charCount(c); + + if ((c & 0xFFFE) == 0xFFFE + || Character.getType(c) == Character.SURROGATE) + return false; + } + + return true; + } + + /** + * Check for any control characters (including tab, LF, and CR) in + * the string. + */ + public static boolean containsNoControlCharacters(String text) { + for(Character c : text.toCharArray()) { + if(Character.getType(c) == Character.CONTROL) + return false; + } + + return true; + } + + /** + * Check for any unpaired directional or annotation characters in + * the string, or any nested annotations. + */ + public static boolean containsNoInvalidFormatting(String text) { + int dirCount = 0; + boolean inAnnotatedText = false; + boolean inAnnotation = false; + + for (Character c : text.toCharArray()) { + if (c == 0x202A // LEFT-TO-RIGHT EMBEDDING + || c == 0x202B // RIGHT-TO-LEFT EMBEDDING + || c == 0x202D // LEFT-TO-RIGHT OVERRIDE + || c == 0x202E) { // RIGHT-TO-LEFT OVERRIDE + dirCount++; + } + else if (c == 0x202C) { // POP DIRECTIONAL FORMATTING + dirCount--; + if (dirCount < 0) + return false; + } + else if (c == 0xFFF9) { // INTERLINEAR ANNOTATION ANCHOR + if (inAnnotatedText || inAnnotation) + return false; + inAnnotatedText = true; + } + else if (c == 0xFFFA) { // INTERLINEAR ANNOTATION SEPARATOR + if (!inAnnotatedText) + return false; + inAnnotatedText = false; + inAnnotation = true; + } + else if (c == 0xFFFB) { // INTERLINEAR ANNOTATION TERMINATOR + if (!inAnnotation) + return false; + inAnnotation = false; + } + } + + return (dirCount == 0 && !inAnnotatedText && !inAnnotation); + } +} Modified: branches/db4o/freenet/src/freenet/support/TransferThread.java =================================================================== --- branches/db4o/freenet/src/freenet/support/TransferThread.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/TransferThread.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -20,6 +20,14 @@ import freenet.node.PrioRunnable; import freenet.support.io.TempBucketFactory; +/** + * A thread which periodically wakes up and iterates to start fetches and/or inserts. + * + * When calling <code>start()</code>, the thread will iterate the first time after <code>getStartupDelay()</code> milliseconds. + * After each iteration, it will sleep for <code>getSleepTime()</code> milliseconds. + * + * @author xor + */ public abstract class TransferThread implements PrioRunnable, ClientCallback { private final String mName; @@ -44,6 +52,7 @@ protected void start() { mNode.executor.execute(this, mName); + Logger.debug(this, this.getClass().getSimpleName() + " started."); } /** Specify the priority of this thread. Priorities to return can be found in class NativeThread. */ @@ -60,18 +69,21 @@ } try { - while(isRunning) { - Thread.interrupted(); - - try { - iterate(); - Thread.sleep(getSleepTime()); + while(isRunning) { + Thread.interrupted(); + + try { + Logger.debug(this, "Loop running..."); + iterate(); + long sleepTime = getSleepTime(); + Logger.debug(this, "Loop finished. Sleeping for " + (sleepTime/(1000*60)) + " minutes."); + Thread.sleep(sleepTime); + } + catch(InterruptedException e) { + mThread.interrupt(); + } } - catch(InterruptedException e) { - mThread.interrupt(); - } } - } finally { abortAllTransfers(); @@ -82,6 +94,13 @@ } } + /** + * Wakes up the thread so that iterate() is called. + */ + public void nextIteration() { + mThread.interrupt(); + } + protected void abortAllTransfers() { Logger.debug(this, "Trying to stop all requests & inserts"); @@ -130,7 +149,20 @@ Logger.debug(this, "Removed insert for " + p.getURI()); } + protected int fetchCount() { + synchronized(mFetches) { + return mFetches.size(); + } + } + + protected int insertCount() { + synchronized(mInserts) { + return mInserts.size(); + } + } + public void terminate() { + Logger.debug(this, "Terminating..."); isRunning = false; mThread.interrupt(); @@ -144,6 +176,7 @@ } } } + Logger.debug(this, "Terminated."); } Modified: branches/db4o/freenet/src/freenet/support/URIPreEncoder.java =================================================================== --- branches/db4o/freenet/src/freenet/support/URIPreEncoder.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/URIPreEncoder.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -18,7 +18,8 @@ public class URIPreEncoder { // We deliberately include '%' because we don't want to interfere with stuff which is already encoded. - public final static String allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-!.~'()*,;:$&+=?/@%"; + // add "#" here too, this allow anchors + public final static String allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-!.~'()*,;:$&+=?/@%#"; public static String encode(String s) { StringBuilder output = new StringBuilder(s.length()*2); Modified: branches/db4o/freenet/src/freenet/support/io/MultiReaderBucket.java =================================================================== --- branches/db4o/freenet/src/freenet/support/io/MultiReaderBucket.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/io/MultiReaderBucket.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -36,7 +36,8 @@ synchronized(this) { if(closed) return null; Bucket d = new ReaderBucket(); - if(readers == null) readers = new ArrayList<Bucket>(); + if (readers == null) + readers = new ArrayList<Bucket>(1); readers.add(d); if(Logger.shouldLog(Logger.MINOR, this)) Logger.minor(this, "getReaderBucket() returning "+d+" for "+this+" for "+bucket); Modified: branches/db4o/freenet/src/freenet/support/io/TempBucketFactory.java =================================================================== --- branches/db4o/freenet/src/freenet/support/io/TempBucketFactory.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/src/freenet/support/io/TempBucketFactory.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -17,7 +17,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.lang.ref.WeakReference; -import java.util.Iterator; import java.util.LinkedList; import java.util.ListIterator; import java.util.Queue; @@ -90,7 +89,7 @@ this.currentBucket = cur; this.creationTime = now; this.osIndex = 0; - this.tbis = new Vector<TempBucketInputStream>(); + this.tbis = new Vector<TempBucketInputStream>(1); if(logMINOR) Logger.minor(this, "Created "+this, new Exception("debug")); } Copied: branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java (from rev 25205, trunk/freenet/src/freenet/support/math/MedianMeanRunningAverage.java) =================================================================== --- branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java (rev 0) +++ branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -0,0 +1,63 @@ +package freenet.support.math; + +import java.util.ArrayList; + +/** + * A RunningAverage that tracks both the median and mean of a series of values. + * WARNING: Uses memory and proportional to the number of reports! Only for debugging! + * (Also uses CPU time O(N log N) with the number of reports in currentValue()). + * @author Matthew Toseland <toad at amphibian.dyndns.org> (0xE43DA450) + */ +public class MedianMeanRunningAverage implements RunningAverage { + + final ArrayList<Double> reports; + final TrivialRunningAverage mean; + + public MedianMeanRunningAverage() { + reports = new ArrayList<Double>(); + mean = new TrivialRunningAverage(); + } + + public MedianMeanRunningAverage(MedianMeanRunningAverage average) { + this.mean = new TrivialRunningAverage(average.mean); + this.reports = new ArrayList<Double>(); + reports.addAll(average.reports); + } + + public Object clone() { + return new MedianMeanRunningAverage(this); + } + + public synchronized long countReports() { + return reports.size(); + } + + public synchronized double currentValue() { + int size = reports.size(); + int middle = size / 2; + java.util.Collections.sort(reports); + return reports.get(middle); + } + + public synchronized void report(double d) { + mean.report(d); + reports.add(d); + } + + public void report(long d) { + report((double)d); + } + + public double valueIfReported(double r) { + throw new UnsupportedOperationException(); + } + + public synchronized String toString() { + return "Median "+currentValue()+" mean "+mean.currentValue(); + } + + public synchronized double meanValue() { + return mean.currentValue(); + } + +} Modified: branches/db4o/freenet/test/freenet/clients/http/filter/ContentFilterTest.java =================================================================== --- branches/db4o/freenet/test/freenet/clients/http/filter/ContentFilterTest.java 2009-01-22 18:45:22 UTC (rev 25218) +++ branches/db4o/freenet/test/freenet/clients/http/filter/ContentFilterTest.java 2009-01-22 18:57:06 UTC (rev 25219) @@ -3,11 +3,12 @@ * http://www.gnu.org/ for further details of the GPL. */ package freenet.clients.http.filter; +import java.net.URI; + +import junit.framework.TestCase; import freenet.support.api.BucketFactory; import freenet.support.io.ArrayBucket; import freenet.support.io.ArrayBucketFactory; -import java.net.URI; -import junit.framework.TestCase; /** * A simple meta-test to track regressions of the content-filter @@ -31,9 +32,24 @@ // @see bug #710 private static final String ANCHOR_TEST = "<a href=\"#test\" />"; + private static final String ANCHOR_TEST_EMPTY = "<a href=\"#\" />"; + private static final String ANCHOR_TEST_SPECIAL = "<a href=\"#!$()*+,;=:@ABC0123-._~xyz%3f\" />"; // RFC3986 / RFC 2396 + private static final String ANCHOR_TEST_SPECIAL2 = "<a href=\"#!$&'()*+,;=:@ABC0123-._~xyz%3f\" />"; + private static final String ANCHOR_TEST_SPECIAL2_RESULT = "<a href=\"#!$&'()*+,;=:@ABC0123-._~xyz%3f\" />"; + + // @see bug #2496 + private static final String ANCHOR_RELATIVE1 = "<a href=\"/KSK at test/test.html#C2\">"; + private static final String ANCHOR_RELATIVE2 = "<a href=\"/KSK at test/path/test.html#C2\">"; + private static final String ANCHOR_FALSE_POS1 = "<a href=\"/KSK at test/path/test.html#%23\">"; // yes, this is valid + private static final String ANCHOR_FALSE_POS2 = "<a href=\"/KSK at test/path/%23.html#2\">"; // yes, this is valid too + + // evil hack for #2496 + #2451, <SPACE><#> give <SPACE><%23> + private static final String ANCHOR_MIXED = "<a href=\"/KSK at test/path/music #1.ogg\">"; + private static final String ANCHOR_MIXED_RESULT = "<a href=\"/KSK at test/path/music%20%231.ogg\">"; + // @see bug #2451 - private static final String POUNT_CHARACTER_ENCODING_TEST = "<a href=\"/CHK at DUiGC5D1ZsnFpH07WGkNVDujNlxhtgGxXBKrMT-9Rkw,~GrAWp02o9YylpxL1Fr4fPDozWmebhGv4qUoFlrxnY4,AAIC--8/Testing - [blah] Apostrophe' - gratuitous #1 AND CAPITAL LETTERS!!!!.ogg\" />"; - private static final String POUNT_CHARACTER_ENCODING_TEST_RESULT = "<a href=\"/CHK at DUiGC5D1ZsnFpH07WGkNVDujNlxhtgGxXBKrMT-9Rkw,~GrAWp02o9YylpxL1Fr4fPDozWmebhGv4qUoFlrxnY4,AAIC--8/Testing%20-%20%5bblah%5d%20Apostrophe%27%20-%20gratuitous%20%231%20AND%20CAPITAL%20LETTERS%21%21%21%21.ogg\" />"; + private static final String POUNT_CHARACTER_ENCODING_TEST = "<a href=\"/CHK at DUiGC5D1ZsnFpH07WGkNVDujNlxhtgGxXBKrMT-9Rkw,~GrAWp02o9YylpxL1Fr4fPDozWmebhGv4qUoFlrxnY4,AAIC--8/Testing - [blah] Apostrophe' - gratuitous 1 AND CAPITAL LETTERS!!!!.ogg\" />"; + private static final String POUNT_CHARACTER_ENCODING_TEST_RESULT = "<a href=\"/CHK at DUiGC5D1ZsnFpH07WGkNVDujNlxhtgGxXBKrMT-9Rkw,~GrAWp02o9YylpxL1Fr4fPDozWmebhGv4qUoFlrxnY4,AAIC--8/Testing%20-%20%5bblah%5d%20Apostrophe%27%20-%20gratuitous%201%20AND%20CAPITAL%20LETTERS%21%21%21%21.ogg\" />"; // @see bug #2297 private static final String PREVENT_FPROXY_ACCESS = "<a href=\""+BASE_URI+"\"/>"; private static final String WHITELIST_STATIC_CONTENT = "<a href=\"/static/themes/clean/theme.css\" />"; @@ -50,11 +66,22 @@ assertTrue(HTMLFilter(EXTERNAL_LINK_CHECK2).contains(GenericReadFilterCallback.magicHTTPEscapeString)); assertTrue(HTMLFilter(EXTERNAL_LINK_CHECK3).startsWith(EXTERNAL_LINK_OK)); - // regression testing + // regression testing + // bug #710 assertEquals(ANCHOR_TEST, HTMLFilter(ANCHOR_TEST)); - + assertEquals(ANCHOR_TEST_EMPTY, HTMLFilter(ANCHOR_TEST_EMPTY)); + assertEquals(ANCHOR_TEST_SPECIAL, HTMLFilter(ANCHOR_TEST_SPECIAL)); + assertEquals(ANCHOR_TEST_SPECIAL2_RESULT, HTMLFilter(ANCHOR_TEST_SPECIAL2)); + // bug #2496 + assertEquals(ANCHOR_RELATIVE1, HTMLFilter(ANCHOR_RELATIVE1)); + assertEquals(ANCHOR_RELATIVE2, HTMLFilter(ANCHOR_RELATIVE2)); + assertEquals(ANCHOR_FALSE_POS1, HTMLFilter(ANCHOR_FALSE_POS1)); + assertEquals(ANCHOR_FALSE_POS2, HTMLFilter(ANCHOR_FALSE_POS2)); + // EVIL HACK TEST for #2496 + #2451 + assertEquals(ANCHOR_MIXED_RESULT, HTMLFilter(ANCHOR_MIXED)); + // bug #2451 assertEquals(POUNT_CHARACTER_ENCODING_TEST_RESULT, HTMLFilter(POUNT_CHARACTER_ENCODING_TEST)); - + // bug #2297 assertTrue(HTMLFilter(PREVENT_FPROXY_ACCESS).contains(GenericReadFilterCallback.magicHTTPEscapeString)); assertEquals(WHITELIST_STATIC_CONTENT, HTMLFilter(WHITELIST_STATIC_CONTENT)); } Property changes on: branches/db4o/freenet/test/freenet/support/io/MockInputStream.java ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/freenet/test/freenet/support/io/MockInputStream.java:22002-24445 + /trunk/freenet/test/freenet/support/io/MockInputStream.java:22002-25205
