rc-httpd: set charset=utf-8 for all text/* content types

This commit is contained in:
Alex Musolino 2019-06-17 13:17:16 +09:30
parent 8648e06534
commit 3a3eb0434c
4 changed files with 6 additions and 4 deletions

View file

@ -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>

View file

@ -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>

View file

@ -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)

View file

@ -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