Set_DCL_Env Command

Set_DCL_Env is a program for OSU DECthreads HTTPD CGI scripts to set symbols for the DCL environment. It is similar to CGI_SYMBOLS, and while a little more difficult to use, works more like the CERN HTTPD Server, and doesn't have the limitations of CGI_SYMBOLS (eg. symbol value length).

Set_DCL_Env is part of VMSindex.

Usage:

$ set noon
$ say = "write net_link"
$ crlf = f$fao("!/")    ! or...
$ say "<DNETRECMODE>"   ! Set implied carriage control (optional)
$ mcr 'f$parse("SET_DCL_ENV.EXE;",f$environment("PROCEDURE"))
$ [...]

Can pass a base symbol prefix as an argument (default is "WWW_"). Can pass a form symbol prefix as a second argument to invoke use of CGI-SYMBOLS-like symbol names (default is the CERN WWW_KEY_foo scheme).

Set the Content-Type in the DCL script, e.g.

$ say "Content-Type: text/html", crlf    ! CGI header (two crlf's if
$ [...]                                  ! <DNETRECMODE> is not set)
or via a printf("Content-Type: text/html\n\n") in an executable, for example)
$ define sys$output net_link
$ WWWquery "''database'" "''query'"
$ deassign sys$output
$ [...]

Once this program is run by the initial htbin script, any sequence of executables or other DCL scripts can be called with sys$output assigned to net_link so that their outputs will be sent to the client, and they will all have direct access to the full CGI symbol environment via DCL symbols (accessible via getenv() calls in C programs).

Symbol Set

In addition to setting the base CGI symbols via cgi_set_dcl_env(), it casts HTTP_ACCEPT into a numbered list and count symbol set, coverts POST or GET Form contents into an unescaped, numbered KEY (odd is name, even is value) and count symbol set, or an ISINDEX query into an unescaped, numbered KEY and count symbol set, all as in the DCL symbol support for the CERN httpd. Note that all symbols are limited to 255 characters for DCL, and strings will be clipped to that limit if longer. This code does not symbolize POST contents other than from Forms. If a POST Form submission also has a "?<query>" in the RequestURL (rare, but could occur), the KEY symbol pairs for the Form content precede those for the query.

This code also fills an "entries" structure with the name/value pairs from Forms (like that in QueryVMS.c) so you can easily add functions to do something useful beyond setting the DCL symbols (to supplement whatever you're doing via the DCL command file). As you add such functions, you can include getenv() checks for symbols set by the DCL command file to regulate their implementation. (use the "Check whether we want equal signs appended to names." code as a model). The WWW_PATH_TRANSLATED symbol is not set to "" by cgi_set_dcl_env() if WWW_PATH_INFO is "". This script does set it to "", you won't get a DCL error if you try to use WWW_PATH_TRANSLATED without first checking if WWW_PATH_INFO.nes."".

Differences from the CERN HTTPD Symbol Set

  1. The "WWW_" base and CERN-style form-content symbol prefixes can be replaced via a first argument for Set_DCL_Env.exe. Any symbols set by the calling script for regulating Set_DCL_Env.exe should use the alternate prefix as well (we'll assume it's "WWW_" in the following comments).
  2. By default, the '=' is not retained on the ends of the WWW_KEY_<odd_number> symbols for Form content names. (The count is pointed to by WWW_KEY_COUNT, equivalently to the CERN httpd.) You don't need the equal sign to know that it's the name, and it was a pain to deal with when formatting text within the script for output to the client. The symbol WWW_APPEND_EQUAL_SIGN can be made non-NULL by the calling script if you do want the equal sign appended.
  3. WWW_HTTP_ACCEPT points to the full, comma separated list of accepted MIME types, not to the count of WWW_HTTP_ACCEPT_<number> symbols as does the CERN httpd. The count is pointed to instead by WWW_HTTP_ACCEPT_COUNT. The comma separated list is likely to be clipped at 255 characters (so you'd be unwise to parse it rather than checking the numbered list via a DCL loop, but cgi_set_dcl_env() sets WWW_HTTP_ACCEPT to that list, and so I left it that way. You can also search the accepted MIME types by using <DNETHDR>, but that's more work and overhead than looping through this numbered list.
  4. I didn't include WWW_REFERER_URL, because you can get it as WWW_HTTP_REFERER.
  5. The WWW_HTTP_ACCEPT_LANGUAGE symbol is a comma separated list, as for the CERN server, but is cast to a WWW_HTTP_ACCEPT_LANGUAGE_COUNT and WWW_HTTP_ACCEPT_LANGUAGE_<num> symbol set as well.

Author: Foteos Macrides <macrides@sci.wfbr.edu>.

History:

12 Oct 94  FM   Written for use with the OSU DECthreads httpd.
                (modification of Dave's CGI_SYMBOLS.C for v1.6
                and my QueryVMS.c).

12 Mar 95  FM   Added multi-line TEXTAREA handling, identical to
                     that for the CERN httpd.

13 Mar 95  FM   Added option to process POST or GET Form content
                     equivalently to the v1.7a CGI_SYMBOLS.c, if
                     Set_DCL_Env.exe is invoked with a second
                     (Form prefix) argument.  The first argument
                     must be the base prefix (normally "WWW_").
                     See comments in do_cgi_form_env() concerning
                     the limitations of this symbolizing scheme,
                     but it's easier to use with simple forms.
                     In addition to CGI_SYMBOL.c's foo_FLD_name
                     symbols and foo_FIELDS list, this version
                     includes foo_FLD_COUNT and foo_FIELDS_COUNT
                     symbols (for error checking).

18 Mar 95  FM   Added check for WWW_APPEND_EQUAL_SIGN (replace the
                 "WWW_" with the alternate symbol prefix, if one
                 has been passed as an argument).

22 Apr 95  FM   Added WWW_HTTP_ACCEPT_LANGUAGE symbol and a
                 WWW_HTTP_ACCEPT_LANGUAGE_COUNT and itemized
                 WWW_HTTP_ACCEPT_LANGUAGE_<num> symbol set.

23 Apr 95  FM   Added WWW_AUTH_TYPE handling (is set to the
                 authentication type, e.g., "Basic", or to "" if
                 the script was not invoked with authentication.
                Added code to set the WWW_PATH_TRANSLATED symbol
                 to "" if no translation is present.

28 Apr 95  FM   Added code to set WWW_REMOTE_IDENT and
                 WWW_REMOTE_USER to "" if no translation
                 is present.

20 May 95  FM   Treat CRLF, lone LF or lone CR as 'newline' (LF)
                 when unescaping.

14 Jan 96  FM   Modified do_cgi_form_env() emulation of CGI_Symbols.c
                 to create a comma-separated list of VALUEs for fields
                 which have the same NAME (as in SELECTs with the
                 MULTIPLE attribute set).


Navigation links: [Home] [WWW Information] [CERN to OSU Conversion]
HTML 3.2 Checked... Best viewed with ANY browser! http://hepwww.rl.ac.uk/Delphi/Adye/wwwdoc/Set_DCL_Env.html based on comments in Set_DCL_Env.c by Foteos Macrides (last revised 14th January 1996). Converted to HTML (27th November 1996) by
Tim Adye, <T.J.Adye@rl.ac.uk>