Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) httpd.mime: adding jar mimetype *) httpd.java: charset is only appended to mimetype for text mimetypes

thelic7ececbfb285
diff --git a/httpd.mime b/httpd.mime
index 198a6fefb..d490262c0 100644
--- a/httpd.mime
+++ b/httpd.mime
@@ -26,6 +26,7 @@ gz = application/gzip
hqx = application/mac-binhex40
htm = text/html
html = text/html
+jar = application/java-archive
java = text/plain
jpe = image/jpeg
jpeg = image/jpeg
diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java
index 6f096fe31..cbe5abe4c 100644
--- a/source/de/anomic/http/httpd.java
+++ b/source/de/anomic/http/httpd.java
@@ -1228,7 +1228,12 @@ public final class httpd implements serverHandler {
if (httpVersion.toUpperCase().equals(httpHeader.HTTP_VERSION_1_1)) headers.put(httpHeader.CACHE_CONTROL, "no-cache");
else headers.put(httpHeader.PRAGMA, "no-cache");
}
- headers.put(httpHeader.CONTENT_TYPE, (contentType == null)? "text/html; charset=UTF-8" : contentType+"; charset=UTF-8");
+
+ if (contentType == null)
+ contentType = "text/html; charset=UTF-8";
+ else if (contentType.startsWith("text/") && contentType.toLowerCase().indexOf("charset=")==-1)
+ contentType +="; charset=UTF-8";
+ headers.put(httpHeader.CONTENT_TYPE, contentType);
if (contentLength > 0) headers.put(httpHeader.CONTENT_LENGTH, Long.toString(contentLength));
//if (cookie != null) headers.put(httpHeader.SET_COOKIE, cookie);
if (expires != null) headers.put(httpHeader.EXPIRES, httpc.dateString(expires));