Author: toad
Date: 2006-07-06 13:02:10 +0000 (Thu, 06 Jul 2006)
New Revision: 9475
Modified:
trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
trunk/freenet/src/freenet/node/Version.java
Log:
861: Recent changes plus i18n fix in fproxy.
Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2006-07-06
10:12:25 UTC (rev 9474)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2006-07-06
13:02:10 UTC (rev 9475)
@@ -16,6 +16,7 @@
import freenet.client.HighLevelSimpleClient;
import freenet.clients.http.filter.ContentFilter;
import freenet.clients.http.filter.UnsafeContentTypeException;
+import freenet.clients.http.filter.ContentFilter.FilterOutput;
import freenet.config.Config;
import freenet.config.InvalidConfigValueException;
import freenet.config.SubConfig;
@@ -181,7 +182,9 @@
try {
if(!force && !forcedownload) {
- data = ContentFilter.filter(data,
ctx.getBucketFactory(), typeName, uri, null);
+ FilterOutput fo =
ContentFilter.filter(data, ctx.getBucketFactory(), typeName, uri, null);
+ data = fo.data;
+ typeName = fo.type;
}
if (forcedownload) {
Modified: trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
2006-07-06 10:12:25 UTC (rev 9474)
+++ trunk/freenet/src/freenet/clients/http/filter/ContentFilter.java
2006-07-06 13:02:10 UTC (rev 9475)
@@ -100,11 +100,21 @@
return (MIMEType) mimeTypesByName.get(mimeType);
}
+ public static class FilterOutput {
+ public final Bucket data;
+ public final String type;
+
+ FilterOutput(Bucket data, String type) {
+ this.data = data;
+ this.type = type;
+ }
+ }
+
/**
* Filter some data.
* @throws IOException If an internal error involving buckets occurred.
*/
- public static Bucket filter(Bucket data, BucketFactory bf, String
typeName, URI baseURI, FoundURICallback cb) throws UnsafeContentTypeException,
IOException {
+ public static FilterOutput filter(Bucket data, BucketFactory bf, String
typeName, URI baseURI, FoundURICallback cb) throws UnsafeContentTypeException,
IOException {
String type = typeName;
String options = "";
String charset = null;
@@ -146,7 +156,7 @@
else {
if(handler.safeToRead) {
- return data;
+ return new FilterOutput(data, typeName);
}
if(handler.readFilter != null) {
@@ -154,7 +164,10 @@
charset = detectCharset(data, handler);
}
- return handler.readFilter.readFilter(data, bf,
charset, otherParams, new GenericReadFilterCallback(baseURI, cb));
+ Bucket outputData =
handler.readFilter.readFilter(data, bf, charset, otherParams, new
GenericReadFilterCallback(baseURI, cb));
+ if(charset != null)
+ type = type + ";charset="+charset;
+ return new FilterOutput(outputData, type);
}
handler.throwUnsafeContentTypeException();
return null;
Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-07-06 10:12:25 UTC (rev
9474)
+++ trunk/freenet/src/freenet/node/Version.java 2006-07-06 13:02:10 UTC (rev
9475)
@@ -18,7 +18,7 @@
public static final String protocolVersion = "1.0";
/** The build number of the current revision */
- private static final int buildNumber = 860;
+ private static final int buildNumber = 861;
/** Oldest build of Fred we will talk to */
private static final int oldLastGoodBuild = 839;