[lug] Apache CGI: ExecCGI for Just One File?

D. Stimits stimits at comcast.net
Mon Apr 22 13:16:33 MDT 2019


That's actually a nice workaround since I'm only experimenting locally, but I think I'll just give in and add links from a static html page to any cgi-bin. Right now I'm just experimenting with CGI because it is available and if my experiment were to be used later the end location is extremely outdated. I find it challenging to experiment such that the intersection of all locations I might work on use roughly the same technology without buying something.

> On April 21, 2019 at 1:51 PM Jack Rosenthal <jack at rosenth.al mailto:jack at rosenth.al > wrote:
> 
> 
>     I vaguely recall doing something like this a while ago as a hack. There
>     may be a better way, but IIRC this worked for what I needed:
> 
>     Make a file in your cgi-bin like default-index-handler.cgi... for
>     example I wrote mine in bash:
> 
>     #!/bin/bash
> 
>     # FIXME: handle security cases
>     # (what happens if .. in REQUEST_URI)?
>     INDEX_SCRIPT="${DOCUMENT_ROOT}/${REQUEST_URI}/index.cgi"
> 
>     # does an index.cgi exist and executable?
>     if [[ -x "${INDEX_SCRIPT}" ]]; then
>     exec "${INDEX_SCRIPT}"
>     else
>     echo "Content-Type: text/html"
>     echo
>     echo "<H1>No index file exists</H1>"
>     fi
> 
>     Then you'll need to set DirectoryIndex to have your custom handler at
>     the end:
> 
>     DirectoryIndex index.html index.htm ... /cgi-bin/default-index-handler.cgi
> 
>     And maybe it'll just work. I think this approach is really hacky, and
>     you'll need to fix the FIXME above, but this is a rough outline of an
>     approach.
> 
>     You may think this is a little bit out of style, so if there's a better
>     way to do this, please someone else chime in. Then again, CGI scripting
>     went out of style a few years ago too... =)
> 
>     Jack
> 
>     --
>     Jack M. Rosenthal
>     http://jack.rosenth.al
> 
>     You can rent this space for only $5/week.
> 
>     _______________________________________________
>     Web Page: http://lug.boulder.co.us
>     Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>     Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20190422/ab73c1f8/attachment.html>


More information about the LUG mailing list