ref: b46a3ee95fa92800b2d2890fe57c98cd8d156f2f
parent: fafc17b04933b27aff30e0bee26475872781632a
author: stanley lieber <stanley.lieber@gmail.com>
date: Fri Jul 11 19:24:27 EDT 2014
rc-httpd/handlers/serve-static: restore simple test for file type and hardcode max_age to 1 hour (thanks eekee)
--- a/rc/bin/rc-httpd/handlers/serve-static
+++ b/rc/bin/rc-httpd/handlers/serve-static
@@ -17,11 +17,23 @@
exit
}
do_log 200
-type=`{file -m $full_path}
-if(~ $type text/*)
- max_age=3600 # 1 hour
-if not
- max_age=604800 # 1 week
+switch($full_path){
+case *.html *.htm
+ type=text/html
+case *.css
+ type=text/css
+case *.txt
+ type='text/plain; charset=utf-8'
+case *.jpg *.jpeg
+ type=image/jpeg
+case *.gif
+ type=image/gif
+case *.png
+ type=image/png
+case *
+ type=`{file -m $full_path}
+}
+max_age=3600 # 1 hour
echo 'HTTP/1.1 200 OK'^$cr
emit_extra_headers
echo 'Content-type: '^$type^'; charset=utf-8'^$cr