summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorAlex Musolino <alex@musolino.id.au>2019-06-17 13:17:16 +0930
committerAlex Musolino <alex@musolino.id.au>2019-06-17 13:17:16 +0930
commit3a3eb0434c3e5bc98b05a4a0a9752a1743b32512 (patch)
treeec9938c26187125d06441c1dc1862165cdb335f8 /rc
parent8648e065346f354c354789fddf0e463bbeb529cb (diff)
downloadplan9front-3a3eb0434c3e5bc98b05a4a0a9752a1743b32512.tar.xz
rc-httpd: set charset=utf-8 for all text/* content types
Diffstat (limited to 'rc')
-rwxr-xr-xrc/bin/rc-httpd/handlers/dir-index2
-rwxr-xr-xrc/bin/rc-httpd/handlers/error2
-rwxr-xr-xrc/bin/rc-httpd/handlers/redirect2
-rwxr-xr-xrc/bin/rc-httpd/handlers/serve-static4
4 files changed, 6 insertions, 4 deletions
diff --git a/rc/bin/rc-httpd/handlers/dir-index b/rc/bin/rc-httpd/handlers/dir-index
index 8abf6f8fa..f8667f664 100755
--- a/rc/bin/rc-httpd/handlers/dir-index
+++ b/rc/bin/rc-httpd/handlers/dir-index
@@ -32,7 +32,7 @@ case date
do_log 200
echo 'HTTP/1.1 200 OK'^$cr
emit_extra_headers
-echo 'Content-type: text/html'^$cr
+echo 'Content-type: text/html; charset=utf-8'^$cr
echo $cr
echo '<html>
<head>
diff --git a/rc/bin/rc-httpd/handlers/error b/rc/bin/rc-httpd/handlers/error
index 282d8706c..e0608a988 100755
--- a/rc/bin/rc-httpd/handlers/error
+++ b/rc/bin/rc-httpd/handlers/error
@@ -3,7 +3,7 @@
fn do_error{
echo 'HTTP/1.1 '^$1^$cr
emit_extra_headers
- echo 'Content-type: text/html'^$cr
+ echo 'Content-type: text/html; charset=utf-8'^$cr
echo $cr
echo '<html>
<head>
diff --git a/rc/bin/rc-httpd/handlers/redirect b/rc/bin/rc-httpd/handlers/redirect
index e223091eb..90f6baa9e 100755
--- a/rc/bin/rc-httpd/handlers/redirect
+++ b/rc/bin/rc-httpd/handlers/redirect
@@ -19,7 +19,7 @@ case *
}
echo 'Location: ' ^ $2 ^ $cr
emit_extra_headers
-echo 'Content-type: text/html'^$cr
+echo 'Content-type: text/html; charset=utf-8'^$cr
echo $cr
echo '<html><body>'
if(~ $#3 0)
diff --git a/rc/bin/rc-httpd/handlers/serve-static b/rc/bin/rc-httpd/handlers/serve-static
index 1e84f4c26..8cc0ce822 100755
--- a/rc/bin/rc-httpd/handlers/serve-static
+++ b/rc/bin/rc-httpd/handlers/serve-static
@@ -23,7 +23,7 @@ case *.html *.htm
case *.css
type=text/css
case *.txt
- type='text/plain; charset=utf-8'
+ type=text/plain
case *.jpg *.jpeg
type=image/jpeg
case *.gif
@@ -33,6 +33,8 @@ case *.png
case *
type=`{file -m $full_path}
}
+if(~ $type text/*)
+ type=$type^'; charset=utf-8'
max_age=3600 # 1 hour
echo 'HTTP/1.1 200 OK'^$cr
emit_extra_headers