]> git.plutz.net Git - cgilite/blobdiff - server.sh
use proper cgi for response headers, switch cache machanism to timestamps
[cgilite] / server.sh
index dc97607e3f41475325d7d1e15b5302e9acf0a83a..a4229b252c90a409348c909e85df6f6027ff3384 100755 (executable)
--- a/server.sh
+++ b/server.sh
@@ -71,9 +71,10 @@ HTTP_format(){
   /^\r?$/!{H;n;bA}
   
   g
-  s;^(\r?\n)*;;
+  s;^(\r?\n)*;;;
+  s;([^\r])\n;\1\r\n;g;
   aConnection: close\r\n\r
-  /^HTTP\/[0-9]\.[0-9] [1-5][0-9][0-9] .*/bX
+  /^Status: *[1-5][0-9][0-9] .*/{s;^Status: *;HTTP/1.1 ;; bX}
   s;^(.+\n)?Location: .*$;HTTP/1.1 302 Found\r\n&;
   s;^(.+\n)?Content-Type: .*$;HTTP/1.1 200 OK\r\n&;
   
@@ -84,3 +85,10 @@ HTTP_format(){
   bX
   '
 }
+
+PATH_INFO="$(invalidate "${PATH_INFO}" '(^|.*/)\.\./.*' '')"
+
+if [ -z "$QUERY_STRING" -a -f "$_DATA/$PATH_INFO" ]; then
+  . "$_EXEC/shcgi/static.sh" "$_DATA/$PATH_INFO"
+  exit 0
+fi |HTTP_format