Tribeless Nomad (tribelessnomad) wrote in lj_dev,
Tribeless Nomad
tribelessnomad
lj_dev

/doc/find CGI script

Please read this if you're interested in the design of the new documentation system, or if you have expertise in FastCGI or non-Apache servers like IIS.

Earlier today (talkread.bml?itemid=22974104), I introduced a plan for assigning canonical URLs to new LJ documentation. Under this plan, a document which could be requested directly as
/doc/html/moodicons.htm
will normally be linked to (from outside the documentation system) using the less specific URL
/doc/find?guide=moodicons.
The redirection is performed by a simple CGI script which will later be enhanced to do various things like selecting from multiple document formats.

I have no experience with IIS or servers other than Apache. To avoid future porting difficulties, it would be helpful if people familiar with IIS or other servers could comment on whether the plan I've described would be more difficult to implement on other servers.



The CGI script is running on my goathack server as cgi-bin/doc_find.pl and is supported by some general-purpose CGI code in cgi-bin/doc_CGI.pm.

View cgi-bin/doc_find.pl as text.
View cgi-bin/doc_CGI.pm as text.

There are a few FIXME lines in doc_find.pl, but they all refer to trapping obscure errors which are nearly always ignored in other CGI scripts.

To get these scripts working, I added the following directives to /etc/httpd.conf:
FastCgiServer /home/tribelessnomad/cgi-bin/doc_find.pl -processes 1 -initial-env LJHOME=/home/tribelessnomad

Alias /doc/find /home/tribelessnomad/cgi-bin/doc_find.pl

<Directory /home/tribelessnomad/cgi-bin>
  <Files doc_find.pl>
    SetHandler fastcgi-script
  </Files>
</Directory>
By the way, I'm pretty familiar with CGI but not with FastCGI / signal handling, so the FastCGI support I've provided is based mainly on what I found in existing files like 404notfound.cgi.

Anyone want to suggest improvements?
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments