slitaz-base-files rev 107

Add /var/www/cgi-bin files since they can be use with Busybox httpd or lighttpd or any web server supporting CGI
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 18 00:52:40 2012 +0100 (2012-03-18)
parents 773fdb10ba5c
children b43c75fab1f6
files rootfs/usr/share/applications/httpd-cgi.desktop rootfs/var/www/cgi-bin/cgi-env.sh rootfs/var/www/cgi-bin/index.cgi
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rootfs/usr/share/applications/httpd-cgi.desktop	Sun Mar 18 00:52:40 2012 +0100
     1.3 @@ -0,0 +1,7 @@
     1.4 +[Desktop Entry]
     1.5 +Encoding=UTF-8
     1.6 +Name=CGI SHell Environment
     1.7 +Exec=browser http://localhost/cgi-bin/cgi-env.sh
     1.8 +Icon=text-x-script
     1.9 +Type=Application
    1.10 +Categories=Application;Development;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/rootfs/var/www/cgi-bin/cgi-env.sh	Sun Mar 18 00:52:40 2012 +0100
     2.3 @@ -0,0 +1,49 @@
     2.4 +#!/bin/sh
     2.5 +. /usr/bin/httpd_helper.sh
     2.6 +header
     2.7 +
     2.8 +cat << EOT
     2.9 +<!DOCTYPE html>
    2.10 +<html xmlns="http://www.w3.org/1999/xhtml">
    2.11 +<head>
    2.12 +	<title>CGI SHell Environment</title>
    2.13 +	<meta charset="utf-8" />
    2.14 +	<link rel="stylesheet" type="text/css" href="style.css" />
    2.15 +</head>
    2.16 +<body>
    2.17 +
    2.18 +<!-- Header -->
    2.19 +<div id="header">
    2.20 +	<h1>CGI SHell Environment</h1>
    2.21 +</div>
    2.22 +
    2.23 +<!-- Content -->
    2.24 +<div id="content">
    2.25 +
    2.26 +<p>
    2.27 +	Welcome to the SliTaz web server CGI Shell environment. Let the power of
    2.28 +	SHell script meet the web! Here you can check HTTP info and try some
    2.29 +	requests. 
    2.30 +</p>
    2.31 +<p>
    2.32 +	Including /usr/bin/httpd_helper.sh in your scripts lets you
    2.33 +	use PHP-like syntax such as: \$(GET var)
    2.34 +</p>
    2.35 +<p>
    2.36 +	QUERY_STRING test: 
    2.37 +	<a href="$SCRIPT_NAME?var=value">$SCRIPT_NAME?var=value</a>
    2.38 +</p>
    2.39 +
    2.40 +<h2>HTTP Info</h2>
    2.41 +<pre>
    2.42 +$(httpinfo)
    2.43 +</pre>
    2.44 +
    2.45 +<!-- End content -->
    2.46 +</div>
    2.47 +
    2.48 +</body>
    2.49 +</html>
    2.50 +EOT
    2.51 +
    2.52 +exit 0
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/rootfs/var/www/cgi-bin/index.cgi	Sun Mar 18 00:52:40 2012 +0100
     3.3 @@ -0,0 +1,35 @@
     3.4 +#!/bin/sh
     3.5 +
     3.6 +[ ! -d ..$QUERY_STRING ] && echo "HTTP/1.1 404 Not Found" || cat <<EOT  
     3.7 +Content-type: text/html
     3.8 +
     3.9 +<!DOCTYPE html>
    3.10 +<html xmlns="http://www.w3.org/1999/xhtml">
    3.11 +<head>
    3.12 +	<title>Index of $QUERY_STRING</title>
    3.13 +	<meta charset="utf-8" />
    3.14 +	<link rel="stylesheet" type="text/css" href="/style.css" />
    3.15 +</head>
    3.16 +
    3.17 +<!-- Header -->
    3.18 +<div id="header">
    3.19 +	<h1>Index of $QUERY_STRING</h1>
    3.20 +</div>
    3.21 +
    3.22 +<!-- Content -->
    3.23 +<div id="content">
    3.24 +<body>
    3.25 +	<ul>
    3.26 +$({ [ "$QUERY_STRING" != "/" ] && echo "../"; ls -p ..$QUERY_STRING; } | \
    3.27 +  sed 's|.*|		<li><a href="&">&</a></li>|')
    3.28 +	</ul>
    3.29 +</div>
    3.30 +
    3.31 +<!-- Footer -->
    3.32 +<div id="footer">
    3.33 +    Copyright &copy; $(date +%Y) <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
    3.34 +</div>
    3.35 +
    3.36 +</body>
    3.37 +</html>
    3.38 +EOT