html question: setting relative path to cgi-bin script
Background:
My mh-book package has an index search engine as a cgi script.
The current version assumes all invocations are done on the
localhost, and I want to make the package fully functional if
called remotely.
I changed the cgi script itself to return relative paths like
"/doc/mh-book/html/SOMEFILE.html" so this will work whether the
script was called locally with
http://localhost/cgi-bin/mh-book-index or remotely using
http://SERVERNAME/cgi-bin/mh-book-index.
Problem:
The problem is invoking the cgi script in the first place
without knowledge of the server name. If I place a link to
/cgi-bin/mh-book-index in an HTML page, the link will work if
that HTML page was initially called with http://, but if I
instead called that page using file:/usr/... then the relative link
becomes file:/cgi-bin/mh-book-index and is broken.
AFAIK, there's no HTML relative tag that specifies a path but
not a server (e.g. use the same server as for this page?),
something like http:///cgi-bin/mh-book-index.
I'm trying to avoid having a postinst script that prompts for a
server name, and inserts it in a static html page in
/usr/doc/mh-book/html/ but that seems unavoidable (I guess that
page would have to be moved to /var/lib/mh-book as well?). I
could also depend on dwww and use its DWWW_SERVERNAME entry in
/etc/dwww/dwww.conf instead of prompting, or create my own
config script based on /usr/sbin/dwwwconfig to guess the server
name.
What a pain... Any suggestions?
Thanks
--
Peter Galbraith
Reply to: