From c7ececbfb28576c18ab5112046f28c8e9d880dc3 Mon Sep 17 00:00:00 2001 From: theli Date: Tue, 7 Mar 2006 15:58:50 +0000 Subject: [PATCH] *) httpd.mime: adding jar mimetype *) httpd.java: charset is only appended to mimetype for text mimetypes git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1839 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- httpd.mime | 1 + source/de/anomic/http/httpd.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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));