From: Elan Ruusamäe Date: Sun, 22 Jan 2012 20:52:51 +0000 (+0000) Subject: - add charset to text content-types; default as utf8 X-Git-Tag: auto/th/lighttpd-1_4_30-3 X-Git-Url: http://git.pld-linux.org/?p=packages%2Flighttpd.git;a=commitdiff_plain;h=f9a4b2d7978eae5646b9dd30d57f2a86def197c8 - add charset to text content-types; default as utf8 Changed files: lighttpd-mime.types.sh -> 1.3 lighttpd.spec -> 1.355 --- diff --git a/lighttpd-mime.types.sh b/lighttpd-mime.types.sh index 455bfa3..6acbe06 100644 --- a/lighttpd-mime.types.sh +++ b/lighttpd-mime.types.sh @@ -13,7 +13,19 @@ awk '{for (a=2; a <= NF; a++) {printf("%s\t%s\n", $1, $a)}}' | \ LC_ALL=C sort -u > mime.types # build lighttpd.conf fragment -awk '{ printf("\t\".%s\"%s=> \"%s\",\n", $2, (length($2) > 4 ? "\t" : "\t\t"), $1)}' \ +awk '{ + ext = $2; + type = $1; + charset = ""; + # add charset for "text/*" types + if (type ~ "text/") { + type = "\"" type "; charset=\" + mimetype_textcharset" + } else { + type = "\"" type "\"" + } + + printf("\t\".%s\"%s=> %s,\n", ext, (length(ext) > 4 ? "\t" : "\t\t"), type); +}' \ < mime.types | LC_ALL=C sort -r > mime.types.conf # sanity check. there can't be more than one mime type mapping for same extension @@ -28,6 +40,8 @@ mv -f mime.types.conf mime.types.conf.tmp # header cat >> mime.types.conf <