]> git.lizzy.rs Git - plan9front.git/commitdiff
rc-httpd: set charset=utf-8 for all text/* content types
authorAlex Musolino <alex@musolino.id.au>
Mon, 17 Jun 2019 03:47:16 +0000 (13:17 +0930)
committerAlex Musolino <alex@musolino.id.au>
Mon, 17 Jun 2019 03:47:16 +0000 (13:17 +0930)
rc/bin/rc-httpd/handlers/dir-index
rc/bin/rc-httpd/handlers/error
rc/bin/rc-httpd/handlers/redirect
rc/bin/rc-httpd/handlers/serve-static

index 8abf6f8facd5501abf87c18fdbdd6479c204a765..f8667f664201105b48562ef0ce5bcb5ceea8d4ee 100755 (executable)
@@ -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>
index 282d8706cddcd031cc05cfc3b545e895f4134036..e0608a9888835c4797d3247e1ac6258b6b22ef39 100755 (executable)
@@ -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>
index e223091ebb653e2c15101ce73b9fde6c4458c597..90f6baa9e70905734ca3a3c542a39d52f79d3bab 100755 (executable)
@@ -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)
index 1e84f4c26a4ce40ce74abae675406a5d8c78a0fc..8cc0ce8222008b94af23627815f560b496247b67 100755 (executable)
@@ -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