Problem: When I search my database with a POST call to mod_cgi
I get back a list of links that look like this:
<p>4 <a href="ifetch?2000+531120375329+F">!Japan: Government plans
law revision to prevent espionage</a><br>
Calling the shell script "ifetch" with 3 variables:
ifetch?2000+531120375329+F
Apache: http://localhost:8000/cgi-bin/ifetch?2000+531120375329+F
returns:
ifetch /var/www/db 2000 531120375329 F
3 args
lighttpd: http://localhost/cgi-bin/ifetch?2000+531120375329+F
returns:
/usr/lib/cgi-bin/ifetch /var/www/db
0 args
parrot.pl tells that that the browser is sending:
GET /cgi-bin/ifetch?2000+473418041343+F HTTP/1.1
Host: localhost:8080
:
: (omitted)
In the script below, you will see that "ifetch" just calls
another program and passes the variables.
The goal is to return the record with the key=531120375329
from the database.
Apache does it. lighttpd doesn't, because no variables
are passed.
My machine:
Linux magadan 2.6.8-2-386 #1 Tue Aug 16 12:46:35 UTC 2005 i686 GNU/Linux
The web servers:
lighttpd-1.4.8 built from source (running on port 80)
apache2_2.0.54-5_i386.deb (running on port 8000)
Inclusions:
- my cgi program "ifetch" (attached below)
- lighttpd.conf (attached below)
Configuration:
I don't think that this is a configuration problem, but I
could be wrong.
Everything is just plain vanilla.
Any guidance greatly appreciated.
=========================================================================
"ifetch"
#!/bin/sh
# From this script, run the isrch_fetch utility and pass 4 arguments:
# $1=dbname, $2=key, $3=field
# isrch_fetch <databases_path> $1 $2 $3
#
# ---- original -------
#exec /usr/local/bin/isrch_fetch /var/www/db $1 $2 $3
# ----- my testing ----------
echo "Content-type: text/plain"
echo ""
echo $0 /var/www/db $1 $2 $3
echo "$# args"
=========================================================================
lighttpd.conf (the bare essentials:
grep -v # /etc/lighttpd/lighttpd.conf)
server.modules = (
"mod_setenv",
"mod_access",
"mod_alias",
"mod_cgi",
"mod_accesslog" )
server.document-root = "/var/www/html"
server.errorlog = "/var/log/lighttpd/error.log"
server.indexfiles = ( "index.php", "index.html",
"index.htm", "default.htm" )
mimetype.assign = (
".pdf" => "application/pdf",
:
: (omitted)
:
".sig" => "application/pgp-signature",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv"
)
accesslog.filename = "/var/log/lighttpd/access.log"
url.access-deny = ( "~", ".inc" )
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
cgi.assign = ( ".awk" => "/usr/bin/awk",
".py" => "/usr/bin/python",
".sh" => "",
"/isearch" => "",
"/ifetch" => "",
"/ihtml" => "",
"/time" => "" )
alias.url = ( "/cgi-bin/" => "/usr/lib/cgi-bin/",
"/images/" => "/var/www/images/" )