Namazu-users-en(old)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: {cgi}



On Tue, 5 Jun 2001, NOKUBI Takatsugu wrote:

> Sorry for my late reply. I'm busy last and this month.

Not a problem, I've got workarounds for now.

> >> <!--#exec cgi="namazu.cgi" -->
> >> 
> >> Is there any variable to find out the name of the calling file -
> >> search.shtml? in this case?
> 
> Hmm... Can the CGI detect such filename in general? Is the server
> define some environment variables?

the server defines the DOCUMENT_NAME variable to refer to the name of
the document, along with others.  eg:

test.shtml:
<!--#exec cgi="test.cgi" -->

test.cgi:
#!/bin/sh

echo "Content-type: text/plain"
echo
set

output: (snipped)

DOCUMENT_NAME=test.shtml
DOCUMENT_PATH_INFO=
DOCUMENT_ROOT=/usr/local/apache/htdocs
DOCUMENT_URI=/~philip/test.shtml
HTTP_REFERER=http://localhost/~philip/test.shtml
REQUEST_URI=/~philip/test.shtml
SCRIPT_FILENAME=/home/philip/public_html/test.cgi
SCRIPT_NAME=/~philip/test.cgi


DOCUMENT_NAME, _PATH_INFO and _URI are not set for direct CGI, only if
done through SSI, so you'd have to do a check for that, and provide it
if present, or default it to the SCRIPT_NAME.  I could add the code in
myself... when I have the time.

Philip

-- 
You are in a maze of UUCP connections, all alike.


Visit my webpage at http://www.ncst.ernet.in/~philip/
Read my writings at http://www.ncst.ernet.in/~philip/writings/

  MSN  philiptellis                         Yahoo!  philiptellis