summaryrefslogtreecommitdiff
path: root/bin/contrib/rc-httpd/handlers/serve-static
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2024-04-07 13:25:49 +0200
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2024-04-07 13:25:49 +0200
commit9cb56dabb676391a9382731347e8d2b07b9437a5 (patch)
tree95302f041497679202722d9896ec1386bed2d86c /bin/contrib/rc-httpd/handlers/serve-static
parent0a37a1cc5909e11098963267edc9654b85e7ce16 (diff)
big cleanup
Diffstat (limited to 'bin/contrib/rc-httpd/handlers/serve-static')
-rwxr-xr-xbin/contrib/rc-httpd/handlers/serve-static43
1 files changed, 0 insertions, 43 deletions
diff --git a/bin/contrib/rc-httpd/handlers/serve-static b/bin/contrib/rc-httpd/handlers/serve-static
deleted file mode 100755
index 00cc70a..0000000
--- a/bin/contrib/rc-httpd/handlers/serve-static
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/rc
-full_path=`{echo $"FS_ROOT^$"PATH_INFO | urldecode.awk}
-full_path=$"full_path
-if(~ $full_path */)
- error 503
-if(test -d $full_path){
- redirect perm $"location^'/' \
- 'URL not quite right, and browser did not accept redirect.'
- exit
-}
-if(! test -e $full_path){
- error 404
- exit
-}
-if(! test -r $full_path){
- error 503
- exit
-}
-do_log 200
-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 || file -i $full_path} # GROSS
-}
-max_age=3600 # 1 hour
-echo 'HTTP/1.1 200 OK'^$cr
-emit_extra_headers
-echo 'Content-type: '^$type^'; charset=utf-8'^$cr
-echo 'Content-length: '^`{ls -l $full_path | awk '{print $6}'}
-echo 'Cache-control: max-age='^$max_age^$cr
-echo $cr
-exec cat $full_path