#!/bin/bash
cgibin=/home/httpd/cgi-bin
cgi="$1"
url="$2"

server_name=`echo "$url"|sed -e 's:[^/]*//\([^/]*\)/.*:\1:'`
uri=`echo "$url"|sed -e 's:[^/]*//[^/]*/\(.*\):\1:'`
case $"url" in
*\?*)
    script=`echo "$url"|sed -e 's:[^/]*//[^/]*/\([^\?]*\)?.*:\1:'`
    query=`echo "$url"|sed -e 's:[^/]*//[^/]*/[^\?]*?\(.*\):\1:'`
    ;;
*)
    script=`echo "$url"|sed -e 's:[^/]*//[^/]*/\([^\?]*\):\1:'`
    query=''
    ;;
esac


for v in `env|sed -e 's/=.*//'` ; do
    unset $v
done

export PATH='/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin'

export DOCUMENT_ROOT='/local/html'
export HTTP_ACCEPT='image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*'
export HTTP_ACCEPT_CHARSET='iso-8859-1,*,utf-8'
export HTTP_ACCEPT_ENCODING='gzip'
export HTTP_ACCEPT_LANGUAGE='fr, es, en'
export HTTP_CONNECTION='Keep-Alive'
export HTTP_PRAGMA='no-cache'
export HTTP_USER_AGENT='Mozilla/4.75 [en] (X11; U; Linux 2.2.13-4mdk i586)'

export HTTP_HOST='localhost'
export REMOTE_ADDR='127.0.0.1'
export REMOTE_PORT='2496'

export SERVER_NAME=$server_name
export SERVER_ADDR='127.0.0.1'

export SERVER_ADMIN='root@localhost'
export SERVER_PORT='80'
export SERVER_SIGNATURE=''
export SERVER_SOFTWARE='Apache/1.3.9 (Unix)  (NetRevolution Advanced Server/Linux-Mandrake) mod_perl/1.21 Midgard/1.2.1 PHP/3.0.12'
export GATEWAY_INTERFACE='CGI/1.1'
export SERVER_PROTOCOL='HTTP/1.0'




export REQUEST_METHOD='GET'
export REQUEST_URI="$uri"
export QUERY_STRING="$query"
export SCRIPT_NAME="`basename $cgi`"
export SCRIPT_FILENAME="$cgi"
PATH_INFO=/create_list_request
PATH_TRANSLATED=$DOCUMENT_ROOT$PATH_INFO

export HTTP_COOKIE=user='listmaster@localhost:b0fd0b88'

env|sort

"$1"
ViewGit