# HG changeset patch # User Christophe Lincoln # Date 1332028360 -3600 # Node ID eb82a783ff602b352af63f332ea89a1b1e9980b6 # Parent 773fdb10ba5c3a13e79b5148084adff0ae5752d9 Add /var/www/cgi-bin files since they can be use with Busybox httpd or lighttpd or any web server supporting CGI diff -r 773fdb10ba5c -r eb82a783ff60 rootfs/usr/share/applications/httpd-cgi.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rootfs/usr/share/applications/httpd-cgi.desktop Sun Mar 18 00:52:40 2012 +0100 @@ -0,0 +1,7 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=CGI SHell Environment +Exec=browser http://localhost/cgi-bin/cgi-env.sh +Icon=text-x-script +Type=Application +Categories=Application;Development; diff -r 773fdb10ba5c -r eb82a783ff60 rootfs/var/www/cgi-bin/cgi-env.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rootfs/var/www/cgi-bin/cgi-env.sh Sun Mar 18 00:52:40 2012 +0100 @@ -0,0 +1,49 @@ +#!/bin/sh +. /usr/bin/httpd_helper.sh +header + +cat << EOT + + + + CGI SHell Environment + + + + + + + + + +
+ +

+ Welcome to the SliTaz web server CGI Shell environment. Let the power of + SHell script meet the web! Here you can check HTTP info and try some + requests. +

+

+ Including /usr/bin/httpd_helper.sh in your scripts lets you + use PHP-like syntax such as: \$(GET var) +

+

+ QUERY_STRING test: + $SCRIPT_NAME?var=value +

+ +

HTTP Info

+
+$(httpinfo)
+
+ + +
+ + + +EOT + +exit 0 diff -r 773fdb10ba5c -r eb82a783ff60 rootfs/var/www/cgi-bin/index.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rootfs/var/www/cgi-bin/index.cgi Sun Mar 18 00:52:40 2012 +0100 @@ -0,0 +1,35 @@ +#!/bin/sh + +[ ! -d ..$QUERY_STRING ] && echo "HTTP/1.1 404 Not Found" || cat < + + + Index of $QUERY_STRING + + + + + + + + +
+ +
    +$({ [ "$QUERY_STRING" != "/" ] && echo "../"; ls -p ..$QUERY_STRING; } | \ + sed 's|.*|
  • &
  • |') +
+
+ + + + + + +EOT