Using CGI

In previous versions I've advised using CGI if at all possible. However since v2html 5.0 (and Netscape 4.7 / IE 4.0) the Javascript hierarchy has got a lot more robust, so that's what I use.

The command line option to v2html that makes it use CGI is:

  -c /cgi_script /path_to_html_files 
To use this you must have installed the v2html CGI script on your web-server. The /cgi_script is the name of the CGI script (with path). The /path_to_v_files is the directory where you are putting your html files.

These paths are the paths your web server sees (not the full paths on the system) so is the same path that appears after http://server when accessing the files.

Here's an example:

  cp v2html-cgi /opt/CERNhttpd/cgi-bin/ 
  chmod 755 /opt/CERNhttpd/cgi-bin/v2html-cgi

  cd /home/web/v2html/example/ex1
  v2html -c /cgi-bin/v2html-cgi /v2html/example/ex1 
         -css http://server/v2html/example/ex1/v2html.css

Note that v2html can't check the parameters to -c while converting the files. You'll have to do it yourself by viewing the hierarchy in your web browser and clicking on [Hide All] at the top of the hierarchy. Make sure that you view the file using the web server (use http://server/v2html/example/ex1/hierarchy.html rather than file:/home/web/v2html/example/ex1/hierarchy.html).

Also note that you have to specify the full URL to your cascading style sheet using the -css option, like this:

 v2html -c /cgi-bin/v2html-cgi /v2html/examples/millennium_clock/hier_cgi

If you get a message like this when you click on [Hide All]:

  Bad script request -- neither 
        nor '/opt/CERNhttpd/cgi-bin/v2html-cg.pp' 
        is executable

Then either there is either a problem with the installation of the cgi script or you have incorrectly specified the first parameter to -c.

If you get a message like this:

  v2html error.

then you have probably got the second parameter to -c wrong.

You may also want to use the -k key_string option to v2html. This lets you specify the key to use to stop people looking at hierarchy files that are protected by web-server security. The default is to use a random key, but this means that you can't have bookmarks of the hierarchy at various states (because the bookmark will contain the key, and the key will change each time you run v2html). To get round this problem you can use -k to specify a key_string to use every time. The key can be any string of digits and letters.

CGI security

The v2html-cgi is initially called when a user clicks on the [Hide All] or [Show All] links at the top of the hierarchy file. It then serves the hierarchy back with the folder links in it. Clicking on one of the the folder links calls v2html-cgi again with different parameters to show the hierarchy suitably collapsed or expanded.

This could potentially be a security hole in your server because the file it reads is specified in the URL and v2html-cgi bypasses all the security that your webserver provides.

To minimize the risk I have tried to be as paranoid as possible when writing it so:


© 1999-2009 Costas Calamvokis