Author: nextgens
Date: 2008-08-08 17:06:13 +0000 (Fri, 08 Aug 2008)
New Revision: 21674
Modified:
trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
quick and dirty implementation of bug #2446: fproxy should allow configurable
max-size parameter
Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2008-08-08
16:52:46 UTC (rev 21673)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2008-08-08
17:06:13 UTC (rev 21674)
@@ -55,7 +55,7 @@
// ?force= links become invalid after 2 hours.
private static final long FORCE_GRAIN_INTERVAL = 60*60*1000;
/** Maximum size for transparent pass-through, should be a config
option */
- static final long MAX_LENGTH = 2*1024*1024; // 2MB
+ static int MAX_LENGTH = 2*1024*1024; // 2MB
static final URI welcome;
static {
Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2008-08-08 16:52:46 UTC (rev 21673)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
2008-08-08 17:06:13 UTC (rev 21674)
@@ -94,6 +94,18 @@
throw new InvalidConfigValueException("Cannot change
SSL on the fly, please restart freenet");
}
}
+
+ class FProxyPassthruMaxSize implements IntCallback {
+
+ public int get() {
+ return FProxyToadlet.MAX_LENGTH;
+ }
+
+ public void set(int val) throws InvalidConfigValueException {
+ if(val == get()) return;
+ FProxyToadlet.MAX_LENGTH = val;
+ }
+ }
class FProxyPortCallback implements IntCallback {
@@ -395,6 +407,9 @@
});
enableInlinePrefetch =
fproxyConfig.getBoolean("enableInlinePrefetch");
+ fproxyConfig.register("passthroughMaxSize", 2*1024*1024,
configItemOrder++, true, false, "SimpleToadletServer.passthroughMaxSize",
"SimpleToadletServer.passthroughMaxSizeLong", new FProxyPassthruMaxSize());
+ FProxyToadlet.MAX_LENGTH =
fproxyConfig.getInt("passthroughMaxSize");
+
fproxyConfig.register("allowedHosts",
"127.0.0.1,0:0:0:0:0:0:0:1", configItemOrder++, true, true,
"SimpleToadletServer.allowedHosts", "SimpleToadletServer.allowedHostsLong",
new FProxyAllowedHostsCallback());
fproxyConfig.register("allowedHostsFullAccess",
"127.0.0.1,0:0:0:0:0:0:0:1", configItemOrder++, true, true,
"SimpleToadletServer.allowedFullAccess",
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-08-08
16:52:46 UTC (rev 21673)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-08-08
17:06:13 UTC (rev 21674)
@@ -1047,6 +1047,8 @@
SimpleToadletServer.illegalCSSName=CSS name must not contain slashes or colons!
SimpleToadletServer.panicButton=Show the panic button?
SimpleToadletServer.panicButtonLong=Shows a 'panic button' on the queue page
that will remove all requests with no confirmation.
+SimpleToadletServer.passthroughMaxSize=Maximum size for transparent
pass-through in fproxy
+SimpleToadletServer.passthroughMaxSizeLong=Maximum size of a file for
transparent pass-through in fproxy
SimpleToadletServer.port=FProxy port
SimpleToadletServer.portLong=The TCP port FProxy should listen on
SimpleToadletServer.ssl=Enable SSL?