                                     ?                                         WASD Hypertext Services <                                         - Technical Overview      #                    1st October 1997   B                    Revised for version 4.4 release of the WASD VMSA                    Hypertext Services HTTP server (October 1997).                       Supercedes:  ,                      1st August 1997 (v4.3),*                      1st July 1997 (v4.2),*                      1st June 1997 (v4.1),-                      1st October 1996 (v3.4), H                      1st December 1995 (initial freeware release, v3.1),,                      9th August 1995 (v2.3),(                      1st May 1995 (v2.1)                      Please Note  G                    As of July 1997 High Frequency Radar Division (HFRD) F                    underwent a change of role and name. It is now WideF                    Area Surveillance Division (WASD). This package has8                    been renamed in accordance with that.                      Abstract   I                    This document is a technical overview of the implemen- H                    tation of the WASD VMS HyperText Transport Daemon. ItH                    contains information on server startup, configurationF                    and CGI scripting, as well as brief descriptions of8                    the major code modules of the server.  H                    Also see "WASD Hypertext Environment" for information<                    on using the WASD VMS Hypertext Services.  H                    It is strongly suggested those using printed versionsI                    of this document also access the Hypertext version. It @                    provides online access to some examples, etc.                                     Author   !                    Mark G. Daniel 2                    Senior Information Technologist2                    Wide Area Surveillance Division>                    Defence Science and Technology Organisation  2                    Mark.Daniel@dsto.defence.gov.au  )                    +61 (8) 82596031 (bus) )                    +61 (8) 82596673 (fax)                       PO Box 1500                    Salisbury'                    South Australia 5108                       Printed Copy   F                    This book is available for printing to a PostScriptH                    printer. Use a browser to access a print menu in this!                    same location.   H                    Some of the online demonstrations may not work due toF                    the local organisation of the hypertext environmentG                    differing from WASD where it was originally written.                                                                ii         L                YouPshouldehaveereceivedeaacopybofcthecGNUeGeneralrPublicils.I                License along with this package; if not, write to the Free L                Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,                USA.       J                OpenVMS, Digital TCP/IP Services for OpenVMS, VAX C, DEC C,                VAX and AXPJ                are registered trademarks of Digital Equipment Corporation.  H                MultiNet is a registered trademark of Cisco Systems, Inc.  D                Pathway is a registered trademark of Attachmate, Inc.  D                TCPware is a registered trademark of Process Software                Corporation.                       MadGoat Software   M                For supporting non-Digital-TCP/IP (UCX) this software uses the 1                NETLIB package by Matthew Madison.   J                Permission is granted to copy and redistribute . . . for no                commercial gain.                      RSA Data Security  H                This software contains code derived in part from RSA DataF                Security, Inc., and used within the specified licensing                conditions:  J                granted to make and use derivative works provided that suchK                works are identified as "derived from the RSA Data Security, L                Inc. MD5 Message-Digest Algorithm" in all material mentioning/                or referencing the derived work.                   Bailey Brown Jr.   M                LZW compression is implemented using code derived in part from K                the PBM suite. This code is copyright by the original author B                and used within the specified licensing conditions:  T                   * GIF Image compression - LZW algorithm implemented with Tree type6                   *                         structure.H                   *                         Written by Bailey Brown, Jr.D                   *                         last change May 24, 1990;                   *                         file: compgif.c                    * X                   *  You may use or modify this code as you wish, as long as you mention3                   *  my name in your documentation.                        P                Contents_________________________________________________________  P                Chapter_1__Introduction__________________________________________      P                Chapter_2__HyperText_Transport_Protocol_Daemon_-_Overview________  P                2.1    Server Features........................................2-1  P                2.2    Server Behaviour.......................................2-2  P                2.3    TCP/IP Packages........................................2-3  P                2.4    International Features.................................2-4  P                Chapter_3__HTTP_Methods_Usage____________________________________  P                3.1    GET Method.............................................3-1  P                3.2    POST, PUT Methods......................................3-1  P                       3.2.1     File Creation/Upload.........................3-1  P                       3.2.2     Directory Creation...........................3-2  P                       3.2.3     File Deletion................................3-2  P                       3.2.4     Directory Deletion...........................3-3  P                3.3    DELETE Method..........................................3-3  P                Chapter_4__Installation_and_Update_______________________________  P                4.1    Local Setup Suggestions................................4-3  P                4.2    Organizing Documents/Data..............................4-4  P                Chapter_5__Server_Account_and_Environment________________________  P                5.1    VMS Account............................................5-1  P                5.2    Account Support Files..................................5-2  P                5.3    HTTPd Command Line.....................................5-7  P                       5.3.1     Server Startup...............................5-7  P                       5.3.2     Server Command Line Control..................5-9  P                         5.3.2.1       Accounting.............................5-9  P                         5.3.2.2       Authentication.........................5-9  P                         5.3.2.3       DCL/Scripting Subprocesses.............5-9  P                         5.3.2.4       Logging...............................5-10  P                         5.3.2.5       Mapping...............................5-10  P                         5.3.2.6       Shutdown..............................5-11  1                                               iii                  M             5.4    Multi-Homed Hosts With Digital TCP/IP.................5-11     M             Chapter_6__Server_Configuration__________________________________   M             6.1    Current Server Configuration...........................6-1   M             6.2    Current Directives.....................................6-1   M             6.3    Multi-Homed and Multi-Port Services...................6-10   M             6.4    Log Format............................................6-10   M             Chapter_7__Message_Configuration_________________________________   M             7.1    Behaviour..............................................7-1   M             7.2    Message File Format....................................7-2   M             Chapter_8__Mapping_Rules_________________________________________   M             8.1    Server Mapping Rules...................................8-2   M             8.2    Rules..................................................8-2   M             8.3    Rule Interpretation....................................8-5   M             8.4    Mapping Examples.......................................8-5   M             8.5    Conditional Mapping....................................8-7   M             8.6    Mapping User Directories (tilde character ("~"))......8-10   M             Chapter_9__Authentication_and_Authorization______________________   M             9.1    Permissions, Path and User.............................9-2   M             9.2    Databases, Authentication and Group....................9-3   M             9.3    Authorization Configuration File.......................9-3   M             9.4    Authorization Configuration Examples...................9-5   M             9.5    Server Authorization Administration....................9-7   M                    9.5.1     Breaking-in To The Server!...................9-7   M             9.6    User Password Modification.............................9-8   M             9.7    SYSUAF-Authenticated Users.............................9-8   M             Chapter_10__Server_Administration________________________________   M             10.1   HTTPd Server Reports..................................10-1   M             10.2   HTTPd Server Revise...................................10-4   M             10.3   HTTPd Server Action...................................10-5   .                                             iv                 M             Chapter_11__Scripting____________________________________________   M             11.1   Caution!..............................................11-1   M             11.2   Scripting Environment.................................11-2   M             11.3   CGI Compliance........................................11-3   M                    11.3.1    Example DCL Scripts.........................11-6   M             11.4   Non-CGI Compliance Output.............................11-7   M             11.5   Raw HTTP Input........................................11-8   M             11.6   CGIplus Scripting.....................................11-8   M             11.7   HTTP Persistant-State Cookies........................11-14   M             Chapter_12__Server_Performance___________________________________   M             12.1   File Record Format....................................12-3   M             12.2   Scripting.............................................12-3   M             12.3   Suggestions...........................................12-5   M             Chapter_13__HTTPd_Web_Update_____________________________________   M             Chapter_14__Utilities____________________________________________   M             14.1   Echo Facility.........................................14-1   M             14.2   Xray Facility.........................................14-1   M             14.3   StreamLF Utility......................................14-2   M             14.4   HTTPd Monitor.........................................14-2   M             14.5   Server Workout (stress-test)..........................14-3   M             Chapter_15__Brief_Introduction_to_HTTPd_Code_____________________   M             15.1   Multi-Threaded........................................15-1   M             15.2   Tasks.................................................15-2   M             15.3   Memory Management.....................................15-3   M             15.4   Output Buffering......................................15-3   M             15.5   Rule-Mapping..........................................15-4   M             15.6   Auto-Scripting........................................15-4   M             15.7   Internal Directives and "Scripts".....................15-4   M             15.8   HTTPd Modules.........................................15-5   M                    15.8.1    ADMIN.C.....................................15-6   M                    15.8.2    AUTH.C......................................15-6   M                    15.8.3    BASIC.C.....................................15-7   .                                              v                 M                    15.8.4    DCL.C.......................................15-7   M                    15.8.5    DESCR.C....................................15-11   M                    15.8.6    DIGEST.C...................................15-11   M                    15.8.7    DIR.C......................................15-12   M                    15.8.8    FILE.C.....................................15-13   M                    15.8.9    HTADMIN.C..................................15-15   M                    15.8.10   HTTPD.C....................................15-15   M                    15.8.11   ISMAP.C....................................15-15   M                    15.8.12   LOGGING.C..................................15-16   M                    15.8.13   MENU.C.....................................15-17   M                    15.8.14   MSG.C......................................15-18   M                    15.8.15   NET.C......................................15-19   M                    15.8.16   PUT.C......................................15-20   M                    15.8.17   REQUEST.C..................................15-21   M                    15.8.18   SSI.C......................................15-22   M                    15.8.19   STMLF.C....................................15-24   M                    15.8.20   SUPPORT.C..................................15-24   M                    15.8.21   UPD.C......................................15-24                               .                                             vi                     M             Chapter__1_______________________________________________________                Introduction    M                As of July 1997 High Frequency Radar Division (HFRD) underwent J                a change of role and name. It is now Wide Area SurveillanceK                Division (WASD). This package has been renamed in accordance                 with that.   G                This document provides an technical overview of the WASD J                VMS HyperText Transport Daemon environment. It is primarilyL                written for use internal to WASD and assumes that perpsectiveJ                without apology. Any additional usage is subordinate to itsH                role within WASD. The software has been written expresslyK                for supporting an intra-organisational hypertext environment J                on a VMS platform (June 1997 note: since first writing thisI                the industry has settled on the term Intranet). It too, is L                unreservedly tailored to this purpose and the requirements ofK                WASD. All programs were designed only to specifically comply L                with the requirements of VAX C and DEC C, within a DEC TCP/IP,                Services for VMS environment.  J                The document assumes a basic understanding of the hypertextH                technologies and uses terms without explaining them (e.g.H                HTTP, HTML, URL, CGI, SSI, etc.) The reader is refered toK                documents specifically on these topics (these are often best 7                consulted on-line, on the Internet WWW).   M                Also see "WASD Hypertext Environment" for information on using 1                the WASD VMS hypertext facilities.   L                It is strongly suggested those using printed versions of thisM                document also access the Hypertext version. It provides online /                demonstrations of some concepts.   (                Reasons For a Local HTTPd  F                Reasons for developing a local HTTPd server are few but                compelling:  K                o  It was prefered to support the hypertext environment on a M                   VMS platform. This is currently (1995) the most widely used 9                   and accessable environment within WASD.   M                o  Existing servers (and there are quite a few variations) are J                   largely Unix based, although it is being supported (to aM                   greater or lesses extent) across a wide range of platforms.1  N                                                              Introduction  1-1 9  (            M                   Ports to VMS, if they exist, are often in progress or half- M                   baked, employing Unixisms that don't translate elegantly to &                   the VMS environment.  J                o  The VMS version of the CERN server (3.0-6) was evaluated"                   during mid-1994:  L                   -  It is not multi-threaded under VMS (i.e. cannot supportK                      concurrent clients). For example, a lengthy search may B                      delay other clients for unacceptable periods.  J                   -  Its performance was good with document transfers, but7                      became poor when running a script.   J                   -  It is acknowleged in the release notes that it cannotG                      handle a client cancelling a data transfer (a not- I                      uncommon action). This was confirmed experimentally.s  D                   Future versions of this server should be evaluatedH                   periodically as it is receiving a good deal of support                    and attention.  G                o  HyperText Transport Protocol, in its current form, is I                   relatively simple to implement to the level required to 8                   support intra-Divisional requirements.  J                o  As of December 1995 the server has worked extremely wellE                   and has a number of facilities tailored for the VMSsI                   environment. It can continue to be utilized until there K                   are overwhelming reasons for implementing something else.   H                o  As of June 1997 the server and its associated softwareL                   continues to evolve and provide a stable and effective VMSL                   Web environment, even with the advent of a small number of.                   commercial VMS Web products.                                           1-2  Introductiont h  r                M             Chapter__2_______________________________________________________   :             HyperText Transport Protocol Daemon - Overview    G                The most fundamental component of the WASD VMS HypertextrG                Services environment is the HTTPd, or HyperText Protocol I                Transport Daemon, or HTTP server. It has a single-process,i7                multi-threaded, asynchronous I/O design.                  2.1 Server Features   H                The package provides a complete implementation of a basic*                HTTP/1.0 server, including:  ;                o  concurrent, multi-threaded client supportC  G                o  "DELETE", "GET", "HEAD", "POST" and "PUT" HTTP methodt                   support   I                o  "If-Modified-Since:" / "304 Not Modified" functionalityrL                   (document is only sent if modified since time specified by                   client)C  G                o  HTTP/1.0 de-facto persistent connections (i.e. "Keep-nK                   Alive:", reducing the number of TCP/IP connects required)   E                o  versatile directory listing (generic and VMS-style)y  M                o  CGI-compliant scripting (with configurable, automatic, MIME 4                   content-type initiated activation)  H                o  CGIplus scripting (offering reduced latency, increasedF                   throughput and reduced system impact when scripting)  <                o  Server-Side Includes (HTML pre-processing)  F                o  clickable-image support (both NCSA and CERN formats)  8                o  smart rule mapping (conditional rules)  J                o  "Basic" and "Digest" user authentication and path/group-%                   based authorizationP  F                o  Optional SYSUAF-authentication and VMS user securityM                   profile based file access control (only for the most securem'                   of LAN environments!)e  J                o  Web-standard, "common" and "combined" access log formatsI                   (allowing processing by most log-analysis tools), along H                   with a user-definition capability, allowing custom log                   formats   N                            HyperText Transport Protocol Daemon - Overview  2-1 i  t            F                o  host-level access control, on per-host or per-domain)                   acceptance or rejection   G                o  single server can support multi-homed (host name) and_(                   multiple port services  H                o  on-line server configuration, including reports on re-L                   quests, loaded configuration, mapping rules, authorization=                   information and graphical activity displays   >                o  cookie support ("Cookie:" HTTP header field)  K                o  customizable message database (capable of supporting non-.=                   English and concurrent, multiple languages)t  F                o  configurable, automatic conversion of documents fromJ                   VARIABLE to STREAM-LF record format (much more efficient#                   with this server).                2.2 Server Behaviour  K                The HTTPd executes permanently on the server host, listening M                for client connection requests on TCP/IP port 80 (by default). M                It provides concurrent services for a (technically) unlimitted L                number of clients (constrained only by the server resources).G                When a client connects the server performs the following.                tasks:   3                1. creates a thread for this request.  ;                2. reads and analyzes the HTTP request sent,U>                   depending on the nature of the request . . .  H                   o  initiates I/O-driven transfer of the requested file  G                   o  initiates I/O-driven interpretation of a menu file   H                   o  initiates I/O-driven processing of an SSI HTML file  I                   o  initiates I/O-driven processing of a clickable-image5!                      mapping file   ;                   o  initiates I/O-driven directory listing   F                   o  initiates I/O-driven file/directory create/update  ?                   o  initiates I/O-driven server administration.  @                   o  initiates I/O-driven web file-system update  E                   o  spawns a subprocess to execute a CGI script (DCLo%                      procedure) with:   J                     -  SYS$COMMAND and SYS$OUTPUT assigned to intermediate4                        mailboxes (essentially pipes)  ?             2-2  HyperText Transport Protocol Daemon - Overview.                 J                     -  SYS$INPUT logical name providing a mailbox allowingJ                        the script to read the raw HTTP header and body (if                        any).  L                     -  CGIPLUSIN logical name providing a mailbox allowing a;                        CGIplus script to read CGI variables   K                     -  CGI-compliant symbols representing the important CGI_/                        variables of the request.  <                     -  for the life of the subprocess HTTPd:  L                        o  controls the essential behaviour of the subprocess5                           via its SYS$COMMAND mailboxv  H                        o  receives data written by the subprocess to itsM                           SYS$OUTPUT via the associated mailbox, writing thisi'                           to the client   I                3. closes the connection to the client and disposes of the (                   thread data structures  L                For I/O intensive activities like file transfer and directoryI                listing, the AST-driven code provides an efficient, multi-nJ                threaded environment for the concurrent serving of multiple                clients..  J                For scripts, the technique of using multi-threaded, concur-L                rent, spawned subprocesses, attached to standard input/outputL                streams, provides a versatile, extensible, powerful scriptingK                environment. Any DCL procedure or image executing within theeJ                subprocess can behave as an HTTP server. This capability isK                employed to easily extend the basic services provided by thesK                core daemon code. An HTTP script/server for this environmenttJ                does not need to concern itself with network activities, itE                merely reads and writes from the standard I/O streams.                2.3 TCP/IP Packagesa  L                The WASD server supports Digital TCP/IP Services (UCX) with a                native image.  G                Using the excellent freeware NETLIB package from MadGoat.M                Software (Matthew Madison), this server can also (potentially).                support  9                o  Cisco MultiNet for OpenVMS, any version.  ;                o  PathWay from Attachmate Inc., any version_  H                o  TCPware from Process Software Corporation, any version  L                o  CMU TCP/IP (VAX only) v6.5 or later is not supported! (too=                   much variation from mainstream IP packages)T  N                            HyperText Transport Protocol Daemon - Overview  2-3                 K                NETLIB requires VAX/VMS v5.2 or later, or OpenVMS Alpha v1.5_                or later.  L                NETLIB must be obtained and installed separately. This is notI                a difficult undertaking for there is a familiar VMSINSTAL-.5                driven installation and configuration..  M                The WASD NETLIB support was developed using v2.1, which may ber                obtained from  1                http://www.madgoat.com/netlib.html.  -                ftp://ftp.madgoat.com/madgoat/1  M                NETLIB support within the WASD server is tested in-house using1M                the Digital TCP/IP Services package. Other TCP/IP packages may ,                or may not perform as tested.  &             2.4 International Features  I                As of version 4.4 the HTTPd server has undergone a limited2C                degree of internationalization. The impetus for this F                development was the use of the package in some EuropeanA                countries where English is not the first language..  M                As this was not within the original critera while building the_M                server it has meant an extensive rewrite of some functionality_I                within the code (I hope it's appreciated ;^) The objective.I                is to provide users of the server with a more familiar and.H                therefore more comfortable environment. Unfortunately theH                server administrators are still confronted by an English-I                language interface and documentation, but then the packagee<                doesn't pretend to be international software!                  Aspects  J                The international features only apply to the server, not to                scripts!.  !                o  Server Messages   K                   The server uses an administrator-customizable database of J                   messages that can contain multiple language instances ofJ                   some or all messages. Although the base English messagesH                   can be completely changed and/or translated to provideI                   any message text required or desired, a more convenient.J                   approach is to supplement this base set with a language-                   specific one.   H                   One language is designated the prefered language. ThisH                   would most commonly be the language appropriate to theG                   geographical location and/or clientele of the server..H                   Another language is designated the base language. This  ?             2-4  HyperText Transport Protocol Daemon - Overviewv                 M                   must have a complete set of messages and is a fall-back for J                   any messages not configured for the additional language.I                   Of course this base language would most commonly be the.+                   original English version.D  G                   More than just two languages can be supported. If the.L                   browser has prefered languages set the server will attemptM                   to match a message with a language in this preference list. M                   If not, then the server-prefered and then the base language H                   message would be issued, in that order. In this way itJ                   would be possible to simultaneously provide for English,I                   French, German and Swedish audiences, just for example.   F                   For message configuration information see Chapter 7.                  o  Server Dates  I                   Dates appearing in server-generated, non-administrative L                   content (e.g. directory listings, not META-tags, which useJ                   Web-standard time formats) will use the natural languageI                   specified by any SYS$LANGUAGE environment in use on the @                   system or specifically created for the server.  *                o  Conditional Rule Mapping  L                   Mapping rules map requested URL paths to physical or otherK                   paths (see Chapter 8). Conditional rules are only applied L                   if the request matches criteria such as prefered language,H                   host address (hence geographical location to a certainJ                   extent), etc. This allows requests for generic documentsE                   (e.g. home pages) to be mapped to language versionsn4                   appropriate to the above criteria.  K                   For example, requests originating with a language prefer- M                   ence of "en, fr" from ".au" can receive an English version,tM                   whilst requests prefering "de, se, en" from ".de" and ".se"aC                   receive German and Swedish versions respectively.t  F                   For conditional mapping information see Section 8.5.                      N                            HyperText Transport Protocol Daemon - Overview  2-5 f  s                M             Chapter__3_______________________________________________________e               HTTP Methods Usage    L                This section primarily describes server-specific characteris-M                tics of the POST and PUT methods. Kludges support the creation E                of directories, and deletion of files and directories.                  3.1 GET Method  M                Of course, the GET method is used to access documents suppliednI                by the server. There is nothing WASD server-specific aboutt                this method.t  !             3.2 POST, PUT Methodsp  I                The WASD HTTPd does not differentiate between POST and PUTr5                methods, both are handled identically.n  I                In environments where authentication and authorization areeG                enabled these methods can be used to upload data to bothfJ                CGI scripts and the server. The handling of POST and PUT by:                scripts is script-specific, see Chapter 11.  &             3.2.1 File Creation/Upload  L                The WASD HTTPd itself will accept POST and PUT data, creatingJ                a file corresponding to the specified path. The data stream%                may be text or binary.   <                Processing is according to MIME content type:  3                o  application/x-www-form-urlencodedt  D                   The server specially processes "application/x-www-A                   form-urlencoded" POSTS (i.e. those generated bynI                   <FORM>...</FORM>, allowing files to be created directlytL                   from HTML forms. The processing eliminates any field namesM                   from the URL-encoded data stream, placing only field valuesdK                   into the file. This capability can be quite useful and is 9                   demonstrated in the Update HTTPd module   *                   <online hypertext link>.  %                o  multipart/form-dataa  N                                                        HTTP Methods Usage  3-1    i            J                   This server can process a request body according to RFC-L                   1867, "Form-based File Upload in HTML". As yet it is not aL                   full implementation. It will not process "multipart/mixed"G                   subsections. The implementation is basic, providing aiH                   facility to allow the upload of a file into the serverH                   administered file system. The ACTION= parameter of theJ                   <FORM> tag must specify the directory (as a URL path) in:                   which the uploaded file will be created.  J                   The following example HTML illustrates how a form may beJ                   used to upload a file from the browser host file system:  ^                      <FORM METHOD=POST ACTION="/web/directory/" ENCTYPE="multipart/form-data">F                      <INPUT TYPE=submit VALUE=" Upload document ... ">>                      <INPUT TYPE=file SIZE=50 NAME=uploadfile>                      </FORM>  )                   <online hypertext link>u  M                   NOTE: This capability has only been tested against Netscape J                   Navigator versions 2 and 3. VMS Netscape Navigator 3.0b5H                   hangs if an upload of a variable-record format file isM                   attempted. Stick to STREAM-LF or fixed, or convert the filei                   to STREAM-LF.                   o  text/html                    text/plain  M                   Text file created according to the path, VMS record type ise                   STREAM-LF.                  o  image/gif *                   application/octet-stream"                   etc., etc., etc.  J                   Any other MIME type is considered binary and the created8                   file is made an UNDEFINED record type.  $             3.2.2 Directory Creation  K                A directory will be created by the HTTPd if a directory pathaE                is provided with the POST or PUT methods. For example:m  /                   /dir1/dir2/dir-to-be-created/                3.2.3 File Deletione  J                A file will be deleted by the HTTPd if the file path endingM                with a wildard version specification is provided with the POSTo+                or PUT methods. For example:   1                   /dir1/dir2/file-to-be.deleted;*   #             3-2  HTTP Methods Usagen u  r            $             3.2.4 Directory Deletion  K                A directory will be deleted by the HTTPd if a directory pathIK                ending with a wildard version specification is provided withc4                the POST or PUT methods. For example:  1                   /dir1/dir2/dir-to-be-deleted/;*P               3.3 DELETE Methodo  D                The DELETE method should delete the file or directory2                corresponding to the supplied path.                                                                            N                                                        HTTP Methods Usage  3-3 i  i                M             Chapter__4_______________________________________________________   #             Installation and Updates    M                The WASD package and updates will always be distributed as ZIPo                archives.  J                For complete package distributions the archive will containM                the complete directory tree. Hence to install or do a complete"G                update it is necessary to SET DEFAULT into the top-leveloG                directory of the disk the package is to be installed on.i  /                   $ SET DEFAULT device:[000000]t  I                For updates to portions of the package only the tree below I                HT_ROOT:[000000] is provided, hence it is necessary to SET <                DEFAULT to HT_ROOT:[000000] before UNZIPping.  0                   $ SET DEFAULT HT_ROOT:[000000]  J                In either case it is recommended to check the integrity of,L                then list the contents of, the archive before UNZIPping. This&                may be done as follows:  4                   $ UNZIP -t device:[dir]archive.ZIP4                   $ UNZIP -l device:[dir]archive.ZIP  H                A complete installation/update (the former) will have the                structure:   <                    Archive:  HT_ROOT:[000000]HTROOT430.ZIP;1  ^                     WASD (HFRD) VMS Hypertext Services, Copyright (c) 1996,1997 Mark G.Daniel.^                     This package (all associated programs), comes with ABSOLUTELY NO WARRANTY.Q                     This is free software, and you are welcome to redistribute itiV                     under the conditions of the GNU GENERAL PUBLIC LICENSE, version 2.  0                      *  Complete v4.3.0 package.5                      *  $ SET DEFAULT device:[000000]f>                      *  $ UNZIP "-V" device:[dir]HTROOT430.ZIP  K                     VMS file attributes saved ... use UnZip 5.n+ on OpenVMSn  .                     Archive created 1-AUG-1997      N                                                   Installation and Update  4-1 v  s            2                     Length    Date    Time    Name2                     ------    ----    ----    ----A                          0  07-30-97  14:15   ht_root/$_read_1st/r?                          0  07-30-97  14:15   ht_root/aacrt060/ ;                          0  07-30-97  14:15   ht_root/auth/ :                          0  07-30-97  14:15   ht_root/axp/B                       5360  07-30-97  13:23   ht_root/changes.html:                          0  07-30-97  14:15   ht_root/doc/                    .                    .                    .F                      16896  07-30-97  09:23   ht_root/vax/wwwrkout.exeM                      16384  07-30-97  09:21   ht_root/vax/wwwrkout_netlib.exe55                     ------                    ------- 7                   19109754                    996 files   >                An update (the latter) will have the structure:  C                    Archive:  HT_ROOT:[000000]HTROOT430_UPD_01.ZIP;1   ^                     WASD (HFRD) VMS Hypertext Services, Copyright (c) 1996,1997 Mark G.Daniel.^                     This package (all associated programs), comes with ABSOLUTELY NO WARRANTY.Q                     This is free software, and you are welcome to redistribute itiV                     under the conditions of the GNU GENERAL PUBLIC LICENSE, version 2.  ]                      *  Mostly minor updates to scripts and utilities for the v4.3.0 package.oS                      *  A couple nuisance-value-bugs have also been fixed in these. V                      *  SDM2HTM can now generate <FRAMESET> documents (see [DOC]*.COM)  K                     VMS file attributes saved ... use UnZip 5.n+ on OpenVMS   .                     Archive created 6-AUG-1997  2                     Length    Date    Time    Name2                     ------    ----    ----    ----B                      42957  08-04-97  07:57   src/utils/wwwrkout.cL                      59664  08-04-97  07:57   src/utils/obj_axp/wwwrkout.objL                      19674  08-04-97  07:57   src/utils/obj_vax/wwwrkout.obj>                      26624  08-04-97  07:57   axp/wwwrkout.exeE                      27136  07-30-97  09:21   axp/wwwrkout_netlib.exet                    .                    .                    .=                      45056  08-05-97  11:02   vax/sdm2htm.exesE                        617  08-05-97  09:23   doc/all_docs_framed.comdI                         44  08-05-97  09:23   doc/all_docs_not_framed.com,=                        544  08-05-97  09:22   doc/readme.htmlt5                     ------                    ------- 6                    2773107                    90 files  (             4-2  Installation and Update r  s            H                The archive may then be UNZIPped. If this is a completelyK                new installation a new directory tree will be created. If an J                update to an existing installation the tree will be created8                "over-the-top" of the existing structure.                  When updating:   8                o  New files and directories are created.  M                o  For existing files a new version is created (the first timefK                   this is about to occur the UNZIPper requests permission - I                   either "A" for all, or "y" or "n" or a per-file basis).   J                o  No obsolete files or directories are removed. Sorry, but#                   this is freeware!g                  Pruning  J                The package comes complete with both VAX and Alpha executa-J                bles, object modules and complete sources. To help conserveL                disk space, the HT_ROOT:[SRC]PRUNE.COM procedure is provided.  J                If it is a stand-alone system, or a cluster containing onlyF                the one hardware architecture, either VAX or Alpha, the>                executables for the other can be deleted using:  +                   $ @HT_ROOT:[SRC]PRUNE EXE   F                If it is suspected that a re-link will not be necessaryG                (which is unlikely unless extensive re-development is toVH                be undertaken), all object files may be deleted using the                following DCL:l  +                   $ @HT_ROOT:[SRC]PRUNE OBJr  M                Being even more ruthless, the entire source tree (C, build andd5                object files) can be eliminated using:o  +                   $ @HT_ROOT:[SRC]PRUNE SRC   L                Any more and you've decided to use some other server package,-                so get rid of it yourself! :^)1  '             4.1 Local Setup Suggestionse  I                Package updates will never contain anything in these threev                directories:c  '                o  HT_ROOT:[HTTP$SERVER]r  !                o  HT_ROOT:[LOCAL]n  (                o  HT_ROOT:[SCRIPT_LOCAL]  N                                                   Installation and Update  4-3 i  l            L                To prevent the overwriting of local configuration files it isJ                suggested these be placed in the HT_ROOT:[LOCAL] directory.H                Startup files will most probably be placed where-ever theG                local site manages system startup. These could be placedsH                in the HT_ROOT:[LOCAL] directory if there is nowhere moreI                appropriate. Authentication databases could also be placed K                in the [LOCAL] directory. The server account's support filesUI                (LOGIN.COM, etc.) may be copied from the HT_ROOT:[EXAMPLE] E                directory into HT_ROOT:[HTTP$SERVER] and customized ast                necessary.   D                In like manner, local DCL scripts or DCL wrappers forM                executable scripts should be placed in HT_ROOT:[SCRIPT_LOCAL].oB                Executables should continue to be placed in HT_EXE:  J                Changes that are made in package configuration files, etc.,H                can then be propagated to the local areas as appropriate.  )             4.2 Organizing Documents/Data   J                It is recommended that the server distribution tree and anyJ                document and other Web-specific data areas be kept separateJ                and distinct. The former in HT_ROOT:[000000], the latter inH                something like WEB:[000000]. This logical device could beI                provided with the following DCL introduced into the server "                startup procedures:  K                   $ DEFINE /SYSTEM /TRANSLATION=CONCEALED WEB DSA811:[WEB.]i  L                The logical organisation of served data is largely hierarchi-M                cal, organised under the Web-server path root, and is achievedv"                via two mechanisms.  L                1. The natural tree structure provided by a hierarchical file                   system.n  G                2. The logical hierarchy possible using rules within the G                   mapping file to place disparate physical areas into av;                   single logical structure (see Chapter 8).n  H                WASD has a single section of the file system for the coreI                Web files, such as the Division home page, help areas, WebaH                documentation, etc., it can be accessed using the logicalD                device WEB:[000000]. Incorporated with this are otherK                subdirectories providing storage for specific collections ofoM                data, such as committee minutes, administration announcements,i                etc.r  K                Physically distinct areas are used for good physical reasonseG                (e.g. the area can best be hosted on a task-local disk),nK                for historical reasons (e.g. the area existed before any WebiL                environment existed) or for reasons of convenience (e.g. lets  (             4-4  Installation and Update                 K                put this where access controls already allow the maintainersm                to manage it).e  L                Reasons for an area being physically integrated with the coreL                Web data area can be legitimate (e.g. there is really nowhereK                else it reasonably belongs), convenience (e.g. let's quicklytL                put it here) or by logical necessity (it really does below asK                part of the core Web enviroment, e.g. documentation on HTML,,                etc.)                  Guidelines   E                In general, only Web-related files need to go into the J                core physical Web file area. All other groupings should, ifM                possible, be decentralised into the portion of the file system M                they represent and logically placed in the server's path usingrH                rules in the mapping file. That is, a given project's WebH                files should be located in the project's part of the fileL                system. If it doesn't have any then it may be a candidate for)                location in the core area.o  H                When locating a Web area in a physically distinct area itI                is possible the maintainers of that data will already havePF                the correct access controls. If locating an area in theF                core hypertext environment it will be necessary to giveJ                the mantainer ownership of the directory area (and possiblyK                disk quota), or provide ACL access if multiple maintains are                 involved.  I                When locating Web-accessable data in a physically distinctsJ                area it will be necessary to update the mapping file with aL                new rule (see Chapter 8). If located within the core Web area4                the rules do not need to be adjusted.                                  N                                                   Installation and Update  4-5                     M             Chapter__5_______________________________________________________e  *             Server Account and Environment    E                The HTTPd server account should be a standard account, K                preferably in a group of its own (definitely at least a non- L                system, non-user group), with sufficient quotas to handle the                 expected traffic.                 5.1 VMS Account   =                The following provides a guide to the account:   U                   Username: HTTP$SERVER                      Owner:  HyperText Daemonpd                   Account:  HTTPD                            UIC:    [377,377] ([HTTPD,HTTP$SERVER])N                   CLI:      DCL                              Tables: DCLTABLES1                   Default:  HT_ROOT:[HTTP$SERVER]s!                   LGICMD:   LOGIN /                   Flags:  Restricted DisNewMaile5                   Primary days:   Mon Tue Wed Thu Frii=                   Secondary days:                     Sat SundX                   Primary   000000000011111111112222  Secondary 000000000011111111112222X                   Day Hours 012345678901234567890123  Day Hours 012345678901234567890123X                   Network:  ##### Full access ######            ##### Full access ######X                   Batch:    ##### Full access ######            ##### Full access ######X                   Local:    -----  No access  ------            -----  No access  ------X                   Dialup:   -----  No access  ------            -----  No access  ------X                   Remote:   -----  No access  ------            -----  No access  ------V                   Expiration:            (none)    Pwdminimum:  6   Login Fails:     0P                   Pwdlifetime:         90 00:00    Pwdchange:      (pre-expired)b                   Last Login:            (none) (interactive), 11-MAY-1995 08:44 (non-interactive)K                   Maxjobs:         0  Fillm:       300  Bytlm:       300000 K                   Maxacctjobs:     0  Shrfillm:      0  Pbytlm:           0aK                   Maxdetach:       0  BIOlm:       512  JTquota:       1024 K                   Prclm:         100  DIOlm:       512  WSdef:         1000 K                   Prio:            4  ASTlm:       600  WSquo:         2000 K                   Queprio:         0  TQElm:       100  WSextent:     20000 K                   CPU:        (none)  Enqlm:       256  Pgflquo:     200000 (                   Authorized Privileges:$                     NETMBX    TMPMBX%                   Default Privileges:r$                     NETMBX    TMPMBX        N                                            Server Account and Environment  5-1                 %             5.2 Account Support Filesr  E                NOTE: The recommended LOGIN.COM (and server startup in H                general) has been modified for version 4. It now involvesG                three files, LOGIN.COM, HTTPD_BATCH.COM and HTTPD80.COM.eK                This was done to more easily support multiple servers in VMS                 clusters.  K                NOTE AGAIN: The introduction of NETLIB support with v4.3 hastE                again resulted in minor changes to startup procedures.e  L                NOTE YET AGAIN: The introduction of the message file and someK                rationalization of the location of local configuration filespJ                and scripts for v4.4 requires some minor changes to startup                procedures.  :                Examples may be found in HT_ROOT:[EXAMPLE].  &                <online hypertext link>                   HTTPd Executables  D                Two server executables are provided with the package.  M                o  HTTPD.EXE - This provides native support for Digital TCP/IPa!                   services (UCX).r  E                o  HTTPD_NETLIB.EXE - This provides NETLIB support for *                   packages other than UCX.                  LOGIN.COM  I                The following is suggested as the LOGIN.COM for the serveroK                account. It provides a secure DCL environment for the server '                image to execute within.                      $ SET NOON#                   $ SET NOCONTROL=YT3                   $ NODENAME = F$GETSYI("NODENAME") 7                   $ IF F$MODE() .EQS. "OTHER" THEN EXIT_7                   $ IF F$MODE() .EQS. "BATCH" THEN EXIT >                   $!(interactive and network modes stop here!)                   $ STOP/ID=0a                  HTTPD_BATCH.COM  E                The following procedure is SUBMITted by system startupcK                procedure under the HTTPd server account, and simply createsdJ                a detached process under the control of HTTPD80.COM, or its                equivalent.  /             5-2  Server Account and Environment  A                                  $! SET VERIFYs#                   $ SET NOCONTROL=Yt                   $ SET NOON3                   $ NODENAME = F$GETSYI("NODENAME")E                   $ PORT = 80T                   $!^                   $! (only needed if multiple servers different within the one system/cluster)<                   $! DEFINE /JOB HTTPD$AUTH HTTPD$AUTH'PORT'@                   $! DEFINE /JOB HTTPD$CONFIG HTTPD$CONFIG'PORT':                   $! DEFINE /JOB HTTPD$MAP HTTPD$MAP'PORT':                   $! DEFINE /JOB HTTPD$MSG HTTPD$MSG'PORT'                   $!V                   $ DEFINE /PROCESS HTTPD$LOG "HT_LOGS:''NODENAME'_''PORT'_ACCESS.LOG"                   $!2                   $ IF F$TRNLNM("HTTPD$USENETLIB"):                   $    THEN HTTPD = "$HT_EXE:HTTPD_NETLIB"3                   $    ELSE HTTPD = "$HT_EXE:HTTPD"                    $ ENDIF(                   $!#                   $ ERROR_COUNT = 0.                   $ HTTPD_LOOP:e0                   $    WRITE SYS$OUTPUT F$TIME()5                   $    HTTPD /PRIORITY=6 /PORT='PORT'EL                   $!   (non-error exit, must be a restart, loop immediately)6                   $    IF $STATUS THEN GOTO HTTPD_LOOP]                   $!   (error exit, gradually extend the period before restarting the server)M4                   $    ERROR_COUNT = ERROR_COUNT + 13                   $    WAIT_HH = ERROR_COUNT / 3600 F                   $    WAIT_MM = (ERROR_COUNT - (WAIT_HH * 3600)) / 60P                   $    WAIT_SS = ERROR_COUNT - (WAIT_HH * 3600) - (WAIT_MM * 60)2                   $    WAIT 00:'WAIT_MM':'WAIT_SS'&                   $    GOTO HTTPD_LOOP#                   $!END_HTTPD_LOOP:                    $!                   $ STOP/ID=00                    HTTPD80.COM  F                The following is suggested as the procedure control the0                execution of the HTTPD.EXE image.                  N                                            Server Account and Environment  5-3                                  $! SET VERIFY                  $ SET NOON!                 $ SET NOCONTROL=Yr1                 $ NODENAME = F$GETSYI("NODENAME")7                 $ PORT = 80w:                 $! DEFINE /JOB HTTPD$AUTH HTTPD$AUTH'PORT'>                 $! DEFINE /JOB HTTPD$CONFIG HTTPD$CONFIG'PORT'8                 $! DEFINE /JOB HTTPD$MAP HTTPD$MAP'PORT'8                 $! DEFINE /JOB HTTPD$MSG HTTPD$MSG'PORT'T                 $ DEFINE /PROCESS HTTPD$LOG "HT_LOGS:''NODENAME'_''PORT'_ACCESS.LOG"0                 $ IF F$TRNLNM("HTTPD$USENETLIB")8                 $    THEN HTTPD = "$HT_EXE:HTTPD_NETLIB"1                 $    ELSE HTTPD = "$HT_EXE:HTTPD"                  $ ENDIFd                 $ HTTPD_LOOP:e.                 $    WRITE SYS$OUTPUT F$TIME()3                 $    HTTPD /PRIORITY=6 /PORT='PORT' J                 $!   (non-error exit, must be a restart, loop immediately)4                 $    IF $STATUS THEN GOTO HTTPD_LOOPK                 $!   (error exit, wait, then try to start the server again) "                 $    WAIT 00:01:00$                 $    GOTO HTTPD_LOOP!                 $!END_HTTPD_LOOP:s                 $ STOP/ID=0                     Privileged ImageU  L                As this image is to be installed with privileges unauthorizedH                use should be prevented by applying an ACL similar to the6                following against the executable image:  3                   $ SET SECURITY HT_EXE:HTTPD.EXE - O                     /ACL=((IDENT=HTTP$SERVER,ACCESS=R+E),(IDENT=*,ACCESS=NONE))   K                This can be done once, at installation, or for peace-of-mind6@                (a.k.a. VMS-ish paranoia) at each server startup.  L                As the HTTP$SERVER account should be completely unprivileged,K                and the HTTPd image requires NETMBX, TMPMBX, PRMMBX, PSWAPM,oI                SYSNAM and SYSPRV privileges, it must be installed using al0                command similar to the following:  @                   $ INSTALL = "$SYS$SYSTEM:INSTALL/COMMAND_MODE"`                   $ INSTALL ADD HT_EXE:HTTPD.EXE /PRIVILEGE=(ALTPRI,PRMMBX,PSWAPM,SYSPRV,SYSNAM)          /             5-4  Server Account and Environment  T  a                            Logical Names  M                The following logical names are essential for the operation of C                the HTTPd server and must be defined before startup:l  L                o  HTTPD$AUTH -  location of the authentication/authorizationH                   configuration file (defined system-wide, or in the job+                   table if server-specific)f  M                o  HTTPD$CONFIG -  location of the configuration file (definedoF                   system-wide, or in the job table if server-specific)  I                o  HTTPD$MAP -  location of the mapping rule file (definedtF                   system-wide, or in the job table if server-specific)  L                o  HTTPD$MSG -  location of the message file (defined system-?                   wide, or in the job table if server-specific)   H                o  HTTPD$GMT -  offset from GMT (e.g. "+10:30", "-01:15")  I                o  HTTPD$LOG -  if logging is enabled and no log file name M                   specified on the command line, this logical must be definedr$                   to locate the file  K                o  CGI-BIN -  system logical defining a search list with the I                   architecture-specific executable directory first, localtL                   script directory second, then the common script directory,(                   as a concealed device.  N                o  HT_AUTH -  directory containing authentication/authorization#                   databases (files)_  K                o  HT_CONF -  directory containing local configuration filesr  F                o  HT_EXE -  directory containing the executable images  I                o  HT_LOGS -  optional definition, for convenient log filer                   specificationo  G                o  HT_SERVER_LOGS -  optional definition, for convenient @                   detached server process log file specification  K                The following logical name is created by the executing HTTPd B                server and defines the name of the control mailbox:  #                o  HTTPDport$CONTROLO  M                The following logical names are created by the executing HTTPdn>                server if the HTTPd monitor utility is enabled:  "                o  HTTPDport$COUNT1  "                o  HTTPDport$COUNT2                  o  HTTPDport$PIDC  #                o  HTTPDport$REQUESTf  N                                            Server Account and Environment  5-5 y  m            /                Server Process Logging DirectoryO  H                The server process log directory (output for the detachedK                HTTPd server processes) may require explicit access controlsiI                for the HTTPd account. This can be done by applying an ACLc(                similar to the following:  :                   $ SET SECURITY HT_ROOT:[LOG]SERVER.DIR -N                     /ACL=((IDENT=HTTP$SERVER,ACCESS=R+W+E, OPTIONS=DEFAULT), -=                           (IDENT=HTTP$SERVER,ACCESS=R+W+E), -iC                           (IDENT=*,ACCESS=NONE, OPTIONS=DEFAULT), -u0                           (IDENT=*,ACCESS=NONE))  H                As with the ACL on the server executable this can be doneH                once, at installation (or, if right over the top, at eachK                server startup). Appropriate disk quotas may also need to bed1                applied. Also see Section 5.3.2.4.                   Startup  J                NOTE: The server system startup DCL (SYSTARTUP_VMS.COM) has-                been modified for version 4.n.   K                Putting all this together the HTTPd server startup procedure :                becomes something similar to the following:  O                 $!(change to "YES" to use NETLIB, otherwise it defaults to UCX)L5                 $ DEFINE /SYSTEM HTTPD$USENETLIB "NO"e[                 $ IF F$TRNLNM("HTTPD$USENETLIB") .AND. F$TRNLNM("NETLIB_SHRXFR") .EQS. "" -e9                      THEN @SYS$STARTUP:NETLIB_STARTUP.COM                  $!]                 $!(it is recommended to provide a physically distinct area for Web documents) J                 $! DEFINE /SYSTEM /TRANSLATION=CONCEALED WEB DSA811:[WEB.]                 $!Q                 $ DEFINE /SYSTEM /TRANSLATION=CONCEALED HT_ROOT DSA811:[HT_ROOT.]                  $!8                 $ SET SECURITY HT_ROOT:[LOG]SERVER.DIR -L                   /ACL=((IDENT=HTTP$SERVER,ACCESS=R+W+E, OPTIONS=DEFAULT), -;                         (IDENT=HTTP$SERVER,ACCESS=R+W+E), -mA                         (IDENT=*,ACCESS=NONE, OPTIONS=DEFAULT), - .                         (IDENT=*,ACCESS=NONE))                 $!H                 $ SCRIPT_ROOT = F$TRNLNM("HT_ROOT") - ".]" + ".SCRIPT.]";                 $ DEFINE /SYSTEM HT_SCRIPT HT_ROOT:[SCRIPT]cT                 $ SCRIPT_LOCAL_ROOT = F$TRNLNM("HT_ROOT") - ".]" + ".SCRIPT_LOCAL.]"G                 $ DEFINE /SYSTEM HT_SCRIPT_LOCAL HT_ROOT:[SCRIPT_LOCAL]d6                 $ IF F$GETSYI("ARCH_NAME") .EQS. "VAX"                 $ THENE                 $    EXE_ROOT = F$TRNLNM("HT_ROOT") - ".]" + ".VAX.]"oS                 $    DEFINE /SYSTEM /TRANSLATION=(CONCEALED) HT_EXE_ROOT 'EXE_ROOT' ?                 $    DEFINE /SYSTEM HT_EXE HT_EXE_ROOT:[000000]o  /             5-6  Server Account and Environment                                   $ ELSEE                 $    EXE_ROOT = F$TRNLNM("HT_ROOT") - ".]" + ".AXP.]" S                 $    DEFINE /SYSTEM /TRANSLATION=(CONCEALED) HT_EXE_ROOT 'EXE_ROOT' ?                 $    DEFINE /SYSTEM HT_EXE HT_EXE_ROOT:[000000]b                 $ ENDIFe;                 $ DEFINE /SYSTEM /TRANSLATION=(CONCEALED) -oM                          CGI-BIN 'EXE_ROOT','SCRIPT_LOCAL_ROOT','SCRIPT_ROOT'e5                 $ DEFINE /SYSTEM HT_AXP HT_ROOT:[AXP]i5                 $ DEFINE /SYSTEM HT_VAX HT_ROOT:[VAX]W                 $!8                 $ DEFINE /SYSTEM HT_AUTH HT_ROOT:[LOCAL]9                 $ DEFINE /SYSTEM HT_LOCAL HT_ROOT:[LOCAL] 6                 $ DEFINE /SYSTEM HT_LOGS HT_ROOT:[LOG]D                 $ DEFINE /SYSTEM HT_SERVER_LOGS HT_ROOT:[LOG.SERVER]                 $!J                 $ DEFINE /SYSTEM HTTPD$AUTH HT_ROOT:[LOCAL]HTTPD$AUTH.CONFN                 $ DEFINE /SYSTEM HTTPD$CONFIG HT_ROOT:[LOCAL]HTTPD$CONFIG.CONFH                 $ DEFINE /SYSTEM HTTPD$MAP HT_ROOT:[LOCAL]HTTPD$MAP.CONFH                 $ DEFINE /SYSTEM HTTPD$MSG HT_ROOT:[LOCAL]HTTPD$MSG.CONF3                 $ DEFINE /SYSTEM HTTPD$GMT "+10:30"                  $!>                 $ INSTALL = "$SYS$SYSTEM:INSTALL/COMMAND_MODE"0                 $ IF F$TRNLNM("HTTPD$USENETLIB")                 $ THEN;                 $    SET SECURITY HT_EXE:HTTPD_NETLIB.EXE - P                      /ACL=((IDENT=HTTP$SERVER,ACCESS=R+E),(IDENT=*,ACCESS=NONE)):                 $    INSTALL ADD HT_EXE:HTTPD_NETLIB.EXE -P                                  /PRIVILEGE=(ALTPRI,SYSPRV,SYSNAM,PRMMBX,PSWAPM)                 $ ELSE4                 $    SET SECURITY HT_EXE:HTTPD.EXE -P                      /ACL=((IDENT=HTTP$SERVER,ACCESS=R+E),(IDENT=*,ACCESS=NONE))3                 $    INSTALL ADD HT_EXE:HTTPD.EXE - P                                  /PRIVILEGE=(ALTPRI,SYSPRV,SYSNAM,PRMMBX,PSWAPM)                 $ ENDIF_M                 $ SUBMIT /QUEUE=SYS$BATCH /USER=HTTP$SERVER /NOLOG /NOPRINT -dI                          HT_ROOT:[HTTP$SERVER]HTTPD_BATCH.COM /PARAM="80"a    "             5.3 HTTPd Command Line                5.3.1 Server Startup  I                When starting up the server several characteristics of thesL                server may be specified using qualifiers on the command line.B                If not specified appropriate defaults are employed.  K                o  /ACCEPT= comma-separated list of hosts/domains allowed tor'                   connect to the server     N                                            Server Account and Environment  5-7                 I                o  /CGI_PREFIX= the prefix to the CGI symbol names created:K                   for a script (defaults to "WWW_", similar to the CERN VMS (                   HTTPd, see Chapter 11)  F                o  /DO= command to be performed by the executing server  G                o  /FILBUF= number of bytes in the read buffer for files0E                   open for processing (i.e. menu files, image mappingaJ                   configuration files, pre-processed HTML files, etc., not(                   direct file transfers)  L                o  /FORMAT= overrides the configuration parameter [LogFormat]  L                o  /REJECT= comma-separated list of hosts/domains not allowed*                   to connect to the server  D                o  /[NO]LOG[=name] either disables logging (overridesM                   configuration directive), or enables logging and optionallysG                   specifies the log file name (also see section LogicalnE                   Names, logging is disabled by default). If the file M                   specification is "SYS$OUTPUT" the server issues log entries M                   to <stdout>, allowing user-defined log formats to be easilye&                   checked and refined.  M                o  /NETBUF= minimum number of bytes in the network read buffer   K                o  /OUTBUF= number of bytes in the output buffer (for direct0K                   file transfers, buffered output from menu interpretation,0+                   HTML-preprocessing, etc.)   C                o  /PRIORITY= server process priority (default is 4)   L                o  /[NO]PROFILE allows SYSUAF-authenticated username securityF                   profiles to be used for file access (see Section 9.7  D                o  /PROMISCUOUS server will accept any authenticationK                   username/password pair (used for testing, demonstrations,M                   etc.)   D                o  /SERVICE= comma-separated, list of server servicesC                   (overrides the [Service] configuration parameter)   J                o  /SUBBUF= number bytes in a subprocess' SYS$OUTPUT buffer  F                o  /[NO]SWAP controls whether the server process may beE                   swapped out of the balance set (default is swapping                    disabled)e  M                o  /[NO]SYSUAF allows username authentication using the server 2                   system's SYSUAF (see Section 9.7  M                Note:  buffer sizes apply on a per-request (thread) basis, andeK                may be tailored for specific environments at server startup.o  /             5-8  Server Account and Environmento o               -             5.3.2 Server Command Line Controle  I                A foreign command for the HTTPD control functionality will M                need to be assigned in the adminstration users' LOGIN.COM, forr                example:   *                   HTTPD == "$HT_EXE:HTTPD"2                   !HTTPD == "$HT_EXE:HTTPD_NETLIB"  I                Some control of the executing server is available from the L                DCL command line on the system on which it is executing. ThisI                functionality, via the /DO= qualifier, is available to the I                privileged user. If a non-default server port, or multipletH                servers on the one system are being used, then it will beL                necessary to provide a /PORT= qualifier with any command, andJ                possibly issue it multiple times. Of course, these commandsF                are available from batch jobs as well as interactively.               5.3.2.1 Accounting  F                Server counters may be zeroed. These counters are thoseH                visible from the statistics admininstration menu item and/                when using the HTTPDMON utility.   "                   $ HTTPD /DO=ZERO  "             5.3.2.2 Authentication                  See Chapter 9.   G                The authorization rule file (HTTP$AUTH) may be reloaded.o  '                   $ HTTPD /DO=AUTH=LOAD   G                The authentication cache may be purged, resulting in re- I                authentication for all subsequent authorization-controlledOK                accesses. This may be useful when disabling authorization orNM                if a user has been locked-out due to too many invalid password                 attempts.  (                   $ HTTPD /DO=AUTH=PURGE  .             5.3.2.3 DCL/Scripting Subprocesses  F                These commands can be useful for flushing any currentlyI                executing CGIplus applications from the server, enabling a M                new version to be loaded with the next access. See Chapter 11.!  M                All scripting subprocesses, busy with a request or not, can beS@                deleted (this may cause the client to lose data).  (                   $ HTTPD /DO=DCL=DELETE  N                                            Server Account and Environment  5-9                 L                A gentler alternative is to delete idle subprocesses and mark@                busy ones for deletion when completed processing.  '                   $ HTTPD /DO=DCL=PURGER               5.3.2.4 Logging   K                Server logging control may also be exercised from the server 3                administration menu, see Chapter 10.                   Open a log file.l  &                   $ HTTPD /DO=LOG=OPEN  J                Optionally open and specify a log file name. This overridesC                any /LOG=file-name or HTTPD$LOG specified file name.M  0                   $ HTTPD /DO=LOG=OPEN=file-name  L                The log may be closed and then immediately reopened. This can;                be used to put a changed format into effect.   (                   $ HTTPD /DO=LOG=REOPEN  M                The log file may be closed and reopened using a different name J                (allowing continuous operation but, for example, with dailyI                log files). This overrides any /LOG=file-name or HTTPD$LOG #                specified file name.   2                   $ HTTPD /DO=LOG=REOPEN=file-name  "                Close the log file.  '                   $ HTTPD /DO=LOG=CLOSE   @                Unwritten log records may be flushed to the file.  '                   $ HTTPD /DO=LOG=FLUSHw  H                The format of log entries may be changed. This only takesG                effect from the next time the log is opened or reopened.NC                Incorrect user-defined formats disable logging untilD                corrected.   /                   $ HTTPD /DO=LOG=FORMAT=stringD               5.3.2.5 Mapping                   See Chapter 8.U  @                The mapping rule file (HTTP$MAP) may be reloaded.  !                   $ HTTPD /DO=MAP$  0             5-10  Server Account and Environment                              5.3.2.6 Shutdown  D                Server shutdown may also be exercised from the server3                administration menu, see Chapter 10.t  K                The server may be shut down, without loss of existing client J                requests. Connection acceptance is stopped and any existingB                requests continue to be processed until conclusion.  "                   $ HTTPD /DO=EXIT  K                The server may be immediately and unconditionally shut down.   #                   $ HTTPD /DO=ABORTe  K                The server may be restarted, without loss of existing clientiJ                requests. Connection acceptance is stopped and any existingG                requests continue to be processed until conclusion. This I                effectively causes the server to exit normally and the DCL /                wrapper procedure to restart it.,  %                   $ HTTPD /DO=RESTART.  5             5.4 Multi-Homed Hosts With Digital TCP/IP   G                A multi-homed host responds to connections for more than I                one network address. Details on configuring Digital TCP/IP J                (UCX) for this behaviour may be found in the Digital TCP/IPH                Management manual, section on "Subnetwork Routing" (3.4.8J                in the November 1995 edition) and Digital TCP/IP ManagementF                Command Reference, section on "SET INTERFACE" (NovemberJ                1995 edition). The server configuration parameter [Service]L                allows for the processing of requests for multiple host-namesM                and/or ports (see Section 6.2) while conditional mapping rules ?                enhance this basic capability (see Section 8.5).h  L                Assuming an alternate, unused host name exists (for example):                     $ UCX c                   UCX> SET HOST "second.host.name" /ADDRESS=131.185.30.2 /ALIAS=("second","SECOND")g                   UCX> [EXIT]                    $,  L                The system IP interface can be determined as follows (in thisF                example it is SE0, the LO0 is the localhost interface):  %                   UCX> SHOW INTERFACE T                                                                              Packetsa                   Interface   IP_Addr         Network mask          Receive          Send     MTUr  N                                           Server Account and Environment  5-11 l  a            a                    SE0        131.185.30.1    255.255.0.0            595567        262764    1500 d                    LO0        127.0.0.1       255.0.0.0                   1           573   65535  ?/                   UCX> SHOW INTERFACE SE0 /FULLc                    Interface: SE0`                     IP_Addr: 131.185.30.1      NETWRK: 255.255.0.0       BRDCST: 131.185.255.255V                                         Ethernet_Addr: AA-00-04-00-59-04    MTU:  1500                   .                    .f                   . :                     Restarting attempts                  0:                     Successful restarts                  0  K                Note the network and broadcast masks of the interface above.vL                The basic procedure then is to create a pseudo-interface (theA                "A" added to the hardware device name) as follows:   `                   UCX> SET INTERFACE SEA0 /HOST="second" /NET=255.255.0.0 /BROAD=131.185.255.255/                   UCX> SET PROTOCOL IP /FORWARD   M                After the above commands the interfaces should appear as shownO                below:e  %                   UCX> SHOW INTERFACEhT                                                                              Packetsa                   Interface   IP_Addr         Network mask          Receive          Send     MTUp  a                    SE0        131.185.30.1    255.255.0.0            595567        262764    1500 a                    SEA0       131.185.30.2    255.255.0.0               169            99    1500 d                    LO0        127.0.0.1       255.0.0.0                   0          2263   65535  ?  M                These commands can be done interactively, during each startup,aM                or placed in the permanent UCX configuration database once, asl                follows:   g                   UCX> SET CONFIG INTERFACE SEA0 /HOST="second" /NET=255.255.0.0 /BROAD=131.185.255.255O6                   UCX> SET CONFIG PROTOCOL IP /FORWARD  -                Note: Originating Host Address   J                Digital TCP/IP Services v4.1 at least, appears to determineI                an outgoing connection's originating host address from thehL                IP address of the "highest" pseudo-interface defined (in thisM                case from the SEA0, resulting in an apparent source address ofeK                131.185.30.2). This can cause some confusion on remote hosts K                as to the origin of a connection, and otherwise be generally.                undesirable.   L                A solution appears to be to assign the primary address to theM                last defined interface. This means the original interface mustl!                be removed using a   0             5-12  Server Account and Environment                 1                   UCX> SET CONFIG NOINTERFACE SE0   H                then explicitly redefining it and then the new interface,K                ensuring the first is the non-primary address and the second                 the primary.                                                                                           N                                           Server Account and Environment  5-13                     M             Chapter__6_______________________________________________________                 Server Configuration    J                WASD's HTTPd configuration was originally a subset based onK                the CERN HTTPd. It has now evolved considerably. By default, J                the system-table logical name HTTPD$CONFIG locates a commonJ                configuration file, unless an individual configuration fileJ                is specified using a job-table logical name. Simple editingH                of this file changes the configuration. Comment lines mayI                be included by prefixing them with the hash "#" character. H                Configuration file directives are not case-sensitive. AnyG                changes to the configuration file can only be enabled by J                restarting the HTTPd process using the following command on!                the server system:(  %                   $ HTTPD /DO=RESTART   ,             6.1 Current Server Configuration  M                A server's currently loaded configuration can be interrogated. 6                See Chapter 10 for further information.  "             6.2 Current Directives  J                NOTE: The format of the configuration file has been changedK                between version 3 and version 4. This was to support on-line L                server configuration and administration (see Chapter 10). TheM                version 3 format will still be read by the HTTPd but the firstPK                time the configuration is updated on-line it is saved in the 1                version 4 format, described below.   K                The example configuration file for the WASD HTTPd server can                 be viewed.O  &                <online hypertext link>  K                Some directives take a single parameter, such as an integer,LF                string or boolean value. Other directives can/must haveL                multiple parameters. The version 4 configuration requires theK                directive to be placed on a line by itself and each separate/M                parameter on a separate line following it. All parameter linesM@                apply to the most recently encountered directive.        N                                                      Server Configuration  6-1 I  A            E                Note that all boolean directives are disabled (OFF) by L                default. This is done so that there can be no confusion aboutH                what is enabled and disabled by default. To use directiveA                controlled facility it must be explicitly enabled.   :                1. [Accept] host/domain name (default: all)  L                   One or more (comma-separated if on the same line) internetL                   host/domain names, with "*" wildcarding for host/subdomainI                   matching, to be explicitly allowed access. Also see the E                   Reject directive. Reject directives have precedence)J                   over Accept directives. The Accept directive may be used?                   multiple times. Also see DNSLookup directive.[                     Examples:R                        [Accept]P)                      *.remote.dsto.gov.auS'                      *.wasd.dsto.gov.au   5                2. [ActivityDays] integer (default: 0)   M                   Specifies the number of days to record activity statistics, I                   available in report form from the server administrationPJ                   menu (see Section 10.1). Zero disables this data collec-H                   tion. The maximum is 28 days. 11520 bytes per day, andK                   80640 per week, is required to store the per-minute data.I  G                3. [AddType] .suffix representation encoding script-namei+                   description  (no default)M  I                   Binds a file suffix (extension, type) to a mime contentdH                   type. The script name is used to auto-script (see Sec-K                   tion 15.6) a specified file type. The description is useds:                   as documentation for directory listings.                     Examples:H                        [AddType]I                      .html  text/html   -       HyperText Markup Languagen:                      .txt   text/plain  -       plain text;                      .gif   image/gif   -       image (GIF) B                      .hlb   text/x-script /Conan  VMS Help libraryQ                      .decw$book   text/x-script   /HyperReader    Bookreader book   J                   (Versions prior to 3.2 used this configuration directiveK                   for the MIME content-type to determine whether a file wasbM                   transfered record-by-record or in binary. This is no longereL                   required and should be removed from existing configuration                   files.)   D                4. [AddIcon] icon-URL ALT-text template  (no default)  %             6-2  Server Configurationb e               M                   Specifies a directory listing icon and alternative text for B                   the mime content type specified in the template.                     Examples:i                        [AddIcon]8                      /icon/-/doc.gif    [HTM]  text/html9                      /icon/-/text.gif   [TXT]  text/plainm8                      /icon/-/image.gif  [IMG]  image/gif  )                5. [AddBlankIcon] icon-URL 0                   [AddDirIcon] icon-URL ALT-text3                   [AddParentIcon] icon-URL ALT-texttB                   [AddUnknownIcon] icon-URL ALT-text (no defaults)  K                   Specifies a directory listing icon for these non-content-r,                   type parts of the listing.                     Examples:m  8                      [AddBlankIcon]    /icon/-/blank.gifA                      [AddDirIcon]      /icon/-/dir.gif      [DIR] A                      [AddParentIcon]   /icon/-/back.gif     [<--] A                      [AddUnknownIcon]  /icon/-/unknown.gif  [???]e  B                6. [AuthBasic] ENABLED|DISABLED (default: DISABLED)  H                   Enables or disables BASIC username authentication. See                   Chapter 9.  :                7. [AuthCacheMinutes] integer (default: 60)  E                   The number of minutes authentication information is I                   cached before being revalidated from the authentication K                   source. Zero disables caching (with a resultant impact onnI                   performance as each request requiring authentication is 6                   validated directly from the source).  C                8. [AuthDigest] ENABLED|DISABLED (default: DISABLED)   I                   Enables or disables Digest username authentication. SeeD                   Chapter 9.  :                9. [AuthDigestGetLife] integer (default: 0)  H                   The number of seconds a digest nonce for a GET request;                   (read) can be used before becoming stale.s  :               10. [AuthDigestPutLife] integer (default: 0)  @                   The number of seconds a digest nonce for a PUTI                   (/POST/DELETE ... write) request can be used before be-m                   coming stale.e  :               11. [AuthFailureLimit] integer (default: 10)  N                                                      Server Configuration  6-3 o               G                   The number of unsuccessful attempts at authentication D                   before the username is disabled. Once disabled anyM                   subsequent attempt is automatically refused without further M                   reference to the authentication source. A disabled username ?                   can be reenabled by simply purging the cache.t  F               12. [AuthVMS] (RETIRED IN v4.4, server /SYSUAF qualifier                    provides this)  .               13. [Busy] integer (default: 10)  L                   The maximum number of concurrent client connections beforeK                   a "server too busy right now ... try again shortly" error ,                   is returned to the client.  F               14. [CommentedInfo] ENABLED|DISABLED (default: DISABLED)  L                   Includes, commented at the beginning of any HTML document,I                   the software ID of the server and any relevant VMS file 1                   specification for the document.   5               15. [DclHardLimit] integer (default: 0)o  I                   The maximum number of DCL/CGI script processing subpro- L                   cesses that may ever exist concurrently (works in conjunc-+                   tion with [DclSoftLimit].9  5               16. [DclSoftLimit] integer (default: 0)e  F                   The number of DCL/CGI script processing subprocessesH                   after which idle subprocesses are deleted to make roomJ                   for new ones. The [DclHardLimit] should be approximatelyH                   25% more than the [DclSoftLimit]. The margin exists toI                   allow for occasional slow run-down of deleted/finishing L                   subprocesses. If these limits are not set (i.e. zero) theyL                   are calculated with [Busy] using "[DclSoftLimit] = [Busy]"M                   and "[DclHardLimit] = [DclSoftLimit] + [DclSoftLimit] / 4".   G               17. [DclFullRequest] ENABLED|DISABLED (default: DISABLED)   G                   Versions of the server prior to 4.3 supplied the fullTH                   request (header then body) to the script. This was notM                   fully CGI-compliant. Versions 4.3 and following supply onlyfM                   the body, although the previous behaviour may be explicitly-D                   selected by enabling this configuration parameter.  I               18. [DclSpawnAuthPriv] ENABLED|DISABLED (default: DISABLED).  K                   By default, when a DCL/scripting subprocess is spawned itcK                   inherits the server's currently enabled privileges, which K                   are none, not even TMPMBX or NETMBX. If this parameter is M                   enabled the subprocess is created with the server account's K                   SYSUAF-authorized privileges (which should never be otherc<                   than NETMBX and TMPMBX). Use with caution.  ;               19. [DclCgiPlusLifeTime] integer (default: 0)8  %             6-4  Server Configuratione T  M            I                   This value represents time in minutes. If this value isAM                   zero CGIplus subprocess may persist indefinitely (excluding I                   explicit and proactive server purging). If non-zero the G                   CGIplus subprocess is terminated the specified numberaJ                   of minutes after it last processed a request. This helpsF                   prevent sporadically used scripts from clogging up a                   system.u  :               20. [DclZombieLifeTime] integer (default: 0)  I                   This value represents time in minutes. If this value is M                   zero the use of persistant DCL subprocesses is disabled. IfdL                   non-zero the zombie subprocess is terminated the specifiedK                   number of minutes after it last processed a request. ThiseK                   helps prevent zombie processes from clogging up a system. !                   See Chapter 11.   C               21. [DirAccess] ON|OFF| SELECTIVE (default: DISABLED)D  K                   Controls directory listings. SELECTIVE allows access only H                   to those directories containing a file .WWW_BROWSABLE.I                   The WASD HTTPd directory access facility always ignores K                   directories containing a file named .WWW_HIDDEN. Also see ,                   the DirWildcard directive.  H               22. [DirDescription] ON|OFF| SELECTIVE (default: DISABLED)  L                   Enables HTML file descriptions during listings. GeneratingG                   HTML descriptions involves opening each HTML file andrH                   searching for <TITLE>...</TITLE> and <H1>...</H1> textM                   to generate the description. This is an obviously resource- J                   intensive activity and on busy servers or systems may be                   disabled.n  =               23. [DirLayout] string (default: I__L__R__S__D)   L                   Allows specification of the directory listing layout. ThisG                   is a short string that specifies the included fields, D                   relative placement and optionally the width of theI                   fields in a directory listing. Each field is controlledtH                   by a single letter and optional leading decimal numberF                   specifying its width. If a width is not specified anG                   appropriate default applies. An underscore is used to L                   indicate a single space and is used to separate the fields/                   (two consecutive works well).   &                   o  C - creation date  M                   o  D - description (having no field-width attribute this is 0                      always best specified last)  >                   o  I - icon (takes no field-width attribute)  M                   o  L - link (highlighted anchor using the name of the file):  N                                                      Server Configuration  6-5                 ?                   o  N - name (no link, why bother? who knows!)   0                   o  O - owner (can be disabled)  &                   o  R - revision date                     o  S - size   I                   o  U - upper-case file and directory names (must be thew%                      first character)e  ;                   As illustrated in the following examples:a  3                      [DirLayout]       I__15L__S__D 4                      [DirLayout]       UI__15L__S__D1                      [DirLayout]       15L__9R__S52                      [DirLayout]       15N_9C_9R_S  ?               24. [DirNoPrivIgnore] ON|OFF  (default: DISABLED)d  I                   To prevent browsing through directories (perhaps due to J                   inadvertant mapping) that have file permissions allowingJ                   no WORLD access the server stops listing and reports theJ                   error the first time a protection violation occurs. ThisK                   behaviour may be changed to ignore the violation, listing6:                   only those files to which it has access.  8               25. [DirOwner] ON|OFF  (default: DISABLED)  H                   Allows specification and display of the RMS file owner                   information.  G               26. [DirPreExpired] ENABLED|DISABLED  (default: DISABLED)   K                   Directory listings and trees may be pre-expired. That is, K                   the listing is reloaded each time the page is referenced.eI                   This is convenient in some environments where directoryCI                   contents change frequently, but adds considerable over- J                   head and so is disabled by default. Individual directoryK                   listings may have the default behaviour over-ridden usingh;                   syntax similar to the following examples:   ;                      /dir1/dir2/*.*?httpd=index?expired=yesi:                      /dir1/dir2/*.*?httpd=index?expired=no=                      /tree/dir1/dir2/?httpd=index?expired=yes <                      /tree/dir1/dir2/?httpd=index?expired=no  B               27. [DirReadme] TOP|BOTTOM | OFF (default: DISABLED)  F                   If any of the files provided using the DirReadMeFileI                   directive are located in the directory the contents are I                   included at the top or bottom of the listing (or not at G                   all). Plain-text are included as plain-text, HTML are G                   included as HTML allowing markup tags to be employed.   :               28. [DirReadMeFile] FILE.SUFFIX (no default)  %             6-6  Server Configuration                  G                   Specifies the names and order in which a directory is L                   checked for read-me files. This can be enabled or disabledK                   using the DirReadme directive. Plain-text are included as_L                   plain-text, HTML are included as HTML allowing markup tags!                   to be employed.s                     Examples:t  $                      [DirReadMeFile]                       readme.html                      readme.htmH                      readme.                      readme.txt,                      readme.1sto  :               29. [DirWildcard] OFF|ON (default: DISABLED)  J                   This enables the facility to force the server to provideK                   a directory listing by providing a wildcard file specifi-"K                   cation, even if there is a home (welcome) document in thesK                   directory. This should not be confused with the DirAccesslD                   directive which controls directory listing itself.  B               30. [DNSLookup] ENABLED|DISABLED (default: DISABLED)  J                   Enables or disables connection request host name resolu-H                   tion. This functionality may be expensive (in terms ofK                   processing overhead) and make serving granularity coarserrL                   if DNS is involved. If not enabled and logging is, the en-L                   try is logged against the numeric internet address. If notM                   enabled any accept or reject directive must be expressed asp$                   numeric addresses.  L                   This functionality significantly slows request processing.!                   See Chapter 12.   K                   NOTE: From version 4.4 the HTTPd processes initial client I                   connection at AST delivery level. Some NETLIB-supported M                   TCP/IP packages cannot perform host name resolution at this I                   level and will "hang". If using NETLIB with [DNSlookup] D                   enabled and this seems to occur disable it (NETLIBE                   DNSlookup certainly does work with Digital TCP/IP).   G               31. [ErrorRecommend] ENABLED|DISABLED (default: DISABLED)   M                   Provides a short message recommending action when reporting L                   an error to a client. For example, if a document cannot be#                   found it may say:   ?                      (document, or bookmark, requires revision)   H               32. [ErrorSourceInfo] ENABLED|DISABLED (default: DISABLED)  N                                                      Server Configuration  6-7 a  d            H                   When an error message is generated META information isM                   included showing the server version with source code moduletJ                   and line reporting the error. This is useful informationG                   during development and often during general use. Only /                   disable if this concerns you.   E               33. [ErrorInfo] (RETIRED IN v4.4, message configurationi                    provides this)  I               34. [ErrorSysAdmin] (RETIRED IN v4.4, message configurations                    provides this)  5               35. [InputTimeout] integer (default: 2)x  G                   Number of minutes to allow a connection request to besJ                   in progress without submitting a complete request header(                   before terminating it.  @               36. [Logging] ENABLED|DISABLED (default: DISABLED)  L                   Enables or disables the request log. Logging can slow downI                   request processing and adds overhead. The log file nameeI                   must be specified using the /LOG qualifier or HTTPD$LOGd2                   logical name (see Logical Names.  6               37. [LogFormat] string (default: COMMON)  G                   Specifies one of three pre-defined formats, or a user 4                   definable format. See Section 6.4.  @               38. [Monitor] ENABLED|DISABLED (default: DISABLED)  I                   Allows monitoring via the HTTPDMON utility. Adds slights.                   request processing overhead.  7               39. [OutputTimeout] integer (default: 10)   J                   Number of minutes to allow a request to be output before!                   terminating it.y  .               40. [Port] integer (default: 80)  7                   IP port number for server to bind to.i  7               41. [PutMaxKBytes] integer (default: 250).  G                   Maximum size of an HTTP POST or PUT method request ino                   Kilobytes.  8               42. [PutVersionLimit] integer (default: 3)  E                   File created using the POST or PUT methods have thec2                   specified version limit applied.  ;               43. [Reject] host/domain name (default: none)o  %             6-8  Server Configurations l  e            L                   One or more (comma-separated if on the same line) internetL                   host/domain names, with "*" wildcarding for host/subdomainH                   matching, to be explicitly denied access. Also see theE                   Accept directive. Reject directives have precedencetH                   of Accept directives. The Reject directive may be used?                   multiple times. Also see DNSLookup directive.                      Example:                        [Reject] )                      *.remote.dsto.gov.aui'                      *.wasd.dsto.gov.au   7               44. [RequestHistory] integer (default: 0)o  H                   The server can keep a list of the most recent requestsL                   accessable from the server administration menu. This valueI                   determines the number kept. Zero disables the facility. K                   Each retained request consumes 256 bytes and adds a small 6                   amount of extra processing overhead.  ,               45. [Search] path (no default)  I                   Specifies the physical path to the default query-string (                   keyword search script.                     Examples:e  1                      Search /ht_root/script/querye  /               46. [Service] string (no default)s  K                   This parameter allows multi-homed hosts and multiple port ;                   serving to be specified, see Section 6.3.   <               47. [SSI] ENABLED|DISABLED (default: DISABLED)  E                   Enables or disables Server Side Includes (HTML pre-o                   processing).  D               48. [SSIaccesses] ENABLED|DISABLED (default: DISABLED)  E                   Enables or disables Server Side Includes (HTML pre-a2                   processing) file access counter.  @               49. [SSIexec] ENABLED|DISABLED (default: DISABLED)  E                   Enables or disables Server Side Includes (HTML pre- :                   processing) DCL execution functionality.  <               50. [StreamLF] integer (default: 0 (disabled))  M                   Enables or disables automatic conversion of VARIABLE recordeL                   format documents (files) to STREAM-LF, which are much moreH                   efficient with this server. The integer is the maximumM                   size of a file in Kilobytes that the server will attempt to 8                   convert. Zero disables the conversion.  N                                                      Server Configuration  6-9 r               4               51. [Welcome] file.suffix (no default)  G                   Specifies the names and order in which a directory iseI                   checked for home page files. If no home page is found am1                   directory listing is generated.                      Examples:t                        [Welcome]                      home.html                      home.htme                      home.menu                      home.mnur  3             6.3 Multi-Homed and Multi-Port Services   J                By default the server is defined by the local host name andH                port specified by either [port] or /PORT. The WASD serverI                is capable of concurrently supporting a number of servicesrI                on different port numbers and, if the system is configuredDF                to be multi-homed (see Section 5.4), more than one hostG                name. Using the [Service] configuration parameter or therH                /SERVICE qualifier the server creates an HTTP service forM                each specified. If the host name is omitted it defaults to the I                local host name. If the port is omitted it defaults to 80.   H                This rather contrived example show a server configured to9                provide four services over two host names.D                     [Service]00                   alpha.wasd.dsto.defence.gov.au                   8080/                   beta.wasd.dsto.defence.gov.aue4                   beta.wasd.dsto.defence.gov.au:8000  J                This capability combined with conditional rule mapping (seeL                Section 8.5) offers versatile and powerful service provision.G                The first port specified in the service list becomes thesH                "official" port of the server, using the local host name.               6.4 Log Format  E                The configuration parameter [LogFormat] and the serveriL                qualifier /FORMAT specifies one of three pre-defined formats,F                or a user definable format. Most log analysis tools canI                process the three pre-defined formats and the user-definedtM                format allows for considerable further scope. Logging can also H                be controlled from the command-line, see Section 5.3.2.4.  K                1. COMMON - This is the most common, base logging format foro@                   Web servers. COMMON is the default log format.  &             6-10  Server Configuration                 K                2. COMMON_SERVER - This is an optional format used, for one,iH                   by the NCSA server. It is basically the common format,J                   with the server host name appended to the line (used for8                   multi-homed servers, see Section 6.3).  L                3. COMBINED - This is an optional format used, for one again,L                   by the NCSA server. It too is basically the common format,@                   with the HTTP referer and user agent appended.                  User DefinedM  J                The user defined format allows customised log formats to beI                specified using a selection of commonly required data. TheeJ                specification must begin with a character that is used as aK                substitute when a particular field is empty (use "\0" for noiI                substitute, as in the "windows log format" example below). G                There is a small performance impost when using the user-gK                defined format, as the log entry must be specially formatted J                for each request. A user-defined format containing an errorE                disables logging until corrected. The server continuesL8                functioning without logging any requests.  H                Two different "escape" characters introduce the following                parameters:                   A "!" followed by  4                o  AR - authentication realm (if any)  7                o  AU - authenticated user name (if any)   ?                o  BB - bytes in body (excludes response header)   :                o  BY - bytes in response (includes header)  K                o  CN - client host name (or address if DNS lookup disabled)L  %                o  CA - client addressc  ;                o  EM - request elapsed time in millisecondsr  A                o  ES - request elapsed time in fractional seconds   %                o  ME - request method   B                o  PA - request path (not to be confused with "RQ")  4                o  QS - request query string (if any)  '                o  RF - referer (if any)r  :                o  RQ - complete request string (see below)  +                o  RS - response status code/  '                o  SN - server host name   N                                                     Server Configuration  6-11 d               +                o  SC - script name (if any)d  "                o  SP - server port  7                o  TC - request time (common log format)s  )                o  TG - request time (GMT)   0                o  TV - request time (VMS format)  !                o  UA - user agent                    A "\" followed by  F                o  0 - a null character (used to define the empty field                   character)  #                o  ! - insert an "!"t  "                o  \ - insert a "\"  &                o  n - insert a newline  J                o  q - insert a quote (so that in DCL the quotes won't need                   escaping!)  "                o  t - insert a TAB  K                Any other character is directly inserted into the log entry.   $                Note on "PA" and "RQ"  I                The "PA" and "RQ" have distinct roles. In general the "RQ"iJ                (request) directive will always be used as this is the fullI                request string; script component (if any), path string and L                query string component (if any). The "PA" directive is merelyK                the path string after any script and query string components !                have been removed.                   Examples   =                1. The equivalent of the common log format is:   5                      -!CN - !AU [!TC] \q!RQ\q !RS !BY   @                2. The combined log format could be specified as:  E                      -!CN - !AU [!TC] \q!RQ\q !RS !BY \q!RF\q \q!UA\qs  L                3. The O'Reilly WebSite "windows log format" would be created                   by:   S                      \0!TC\t!CA\t!SN\t!AR\t!AU\t!ME\t!PA\t!RQ\t!EM\t!UA\t!RS\t!BB\t1  &             6-12  Server Configuration                 I                4. The common log format with appended request duration in 2                   seconds could be provided using:  9                      -!CN - !AU [!TC] \q!RQ\q !RS !BY !ESa                                                                                            N                                                     Server Configuration  6-13 u                   M             Chapter__7_______________________________________________________   !             Message Configurations    B                Message configuration is provided for two purposes.  J                1. Some sites would prefer to customize or extend the basicH                   information provided to clients when an error or other                   event occurs.   L                2. Sites that do not use English as a first language may wishH                   to provide some or all of the defined messages using a$                   prefered language.  M                Not all messages provided by the WASD server are customizable,yJ                only those generated for non-administrative content. As theI                WASD server can also report using information derived fromaI                the standard VMS message service (via sys$getmsg())  it isoK                assumed a language-local implementation of this is in use as=I                well. Unfortunately for the non-first-language-English Web I                and system administrators, the menus and messages used for/H                administration purposes, etc., are still only in English.K                The intent of this facility is to provide non-administrationrF                clients only with a more familiar language environment.  K                Also note that the message database only applies to messagestH                generated by the server, not to any generated by scripts,                etc.H               7.1 Behaviourn  E                When an error, or other message or string, needs to be H                provided for the client the message database is accesssed-                using the following algorithm.   H                1. If the client request has specified a list of preferedJ                   languages using the "Accept-Language:" HTTP header fieldK                   the message database is checked for support of that/those J                   languages. If one is found then that language is used to%                   access the message.   E                2. If none is found, or the client has not specified arG                   prefered language, the client host address is checked.H                   against any list of hosts/domains provided against theG                   language (see below). If a match occurs the specified #                   language is used.e  N                                                     Message Configuration  7-1    e            K                3. If neither of the above results in a message language the M                   base language is used (the highest numbered language). This M                   must have a complete set of messages or the server will not                    start!    #             7.2 Message File Format   J                By default, the system-table logical name HTTPD$MSG locatesJ                a common message file, unless an individual message file isJ                specified using a job-table logical name. Simple editing ofM                the message file changes the messages (after a server restart, J                of course). Comment lines may be included by prefixing themM                with the hash character ("#"), and lines continued by ensuring G                the last character is a backslash ("\"). The server williI                concurrently support an additional 3 languages to the base K                English (although this can be increased by recompilation :^)   I                Care must be taken with the message file or the server may                 refuse to start  G                As illustrated below the message file comprises a series"J                of sections. Directives enclosed by square-brackets provide1                information to the message loader.   %                   # this is a commentt                     [version] 4.4E&                   [language] 1 se *.se+                   [language] 2 de *.de,*.sus!                   [language] 3 ene                     [general]   -                   en 01 Sanity check failure.cQ                   de 01 (the same message but in German, which I cannot speak :^)rW                   se 01 (the same message but in Swedish, which I also cannot speak :^)e(                   en 02 String overflow.Q                   de 02 (the same message but in German, which I cannot speak :^) ;                   se 01 (the same message but in Swedish, \o2                   which I still cannot speak :^) \I                   this has also been continued over two additional lines!e/                   en 03 Heap allocation failed. '                   en 04 calloc() failede0                   en 05 Request calloc() failed.(                   en 06 Server too busy.-                   en 07 Server access denied. -                   en 08 Facility is disabled. /                   en 09 Wildcard not permitted.o1                   en 10 Directory layout problem.   &                   [next-section, etc.]  &             7-2  Message Configuration u               G                The square-bracketed section headings have the followingg                functions.   F                1. [version] -  Ensures the correct database version isH                   available for the server version attempting to use it.J                   The message file always needs checking and at least thisJ                   version number changed with server updates. This must be2                   the first directive in the file.  H                2. [language] -  Creates space for assigning the new lan-L                   guage's messages. The number specifies an order within theL                   languages, each must be different, but only the lowest andK                   highest (prefered and base respectively) have operational K                   significance. The highest number should always be English I                   to provide a fall-back message. A short string provideseH                   an identifier for the language. This identifier shouldJ                   be the same as the identifying string in the browser re-I                   quest "Accept-Language:" header field (e.g. "en", "se",rK                   "de", "fr", etc.) Following the language identifier is an J                   optional host/domain list. Multiple hosts/domains may beK                   specified by separating each with a comma. The specifica-dL                   tions may contain wildcards. All the [language] directivesH                   should be grouped at the start of the file immediatelyK                   following the [version] directive. Setting the language'soK                   ordering number to zero disables the language completely.tG                   All messages associated with it will then be ignored.t  I                3. [group-name] -  The messages are divided into groupingscK                   to make them easier to manage. Each group begins with thed'                   group name directive.   L                4. en 01 message -  Each message in a group is assigned usingI                   using this format. The string identifying the language, I                   then the message number (the leading zero just improvesiK                   the format, strictly it is not required), then the actualrI                   message itself. The message can be of arbitrary length. M                   Long messages may be continued on following lines using ther-                   "\" continuation character.m  K                The base language (the highest numbered, which should alwaysiK                be English) must have precisely the right number of messages I                required by the server, too few or too many and the server K                will not start! Additional languages do not have to reassign M                every message! The base language will supply any not assigned. K                A message number of zero is disabled and completely ignored.   K                If messages contain HTML tags that markup must not interferet<                with the general HTML page it is used within.    N                                                     Message Configuration  7-3                 H                Some messages are a composite of multiple strings each ofJ                which is used on a different part of the one page (e.g. forL                the [upd] edit-page). Each of the strings is delimited by theJ                vertical bar "|". Care must be taken when customizing theseJ                strings that the overall number stays the same and that theI                length of each does not become excessive. Although it willgK                not disrupt the server it may significantly disrupt the pagel                layout.  H                All message numbers must be included. To provide an emptyL                string for any one message (not recommended) provide the line9                with nothing following the message number.s                                                                            &             7-4  Message Configuration .  r                M             Chapter__8_______________________________________________________g               Mapping Rules     A                Mapping rules are used for three primary purposes.   A                1. To map a request path onto the VMS file system.   K                2. To process a request path according to specified criteria J                   resulting in an effective path that is different to that,                   supplied with the request.  I                3. To identify requests requiring script activation and touM                   parse the script from the path portion of that request. TheS?                   path portion is then independently re-mapped.e  F                Mapping is basically for server-internal purposes only.J                The only time the path information of the request itself isK                modified is when a script component is removed. At all others<                times the path information remains unchanged.  F                Hence, path authorization is always applied to the pathH                supplied with the request, not to the results of any ruleL                mapping that may have occured! This means authorization pathsJ                may be administered without any ambiguity introduced by any+                rule mapping that may occur.   J                By default, the system-table logical name HTTPD$MAP locatesL                a common mapping rule file, unless an individual rule file isH                specified using a job- table logical name. Simple editingG                of the mapping file changes the rules. Comment lines maysI                be included by prefixing them with the hash "#" character.cM                Although, there is no fixed limit on the number of rules therepJ                are the processing implications of scanning a large, linear                database.  J                Rules are given a basic consistency check when loaded (i.e.G                server startup, map reload, etc.) If there is an obviousoG                problem (unknown rule, missing component, etc., path notoG                absolute) a warning message is generated and the rule isMK                not loaded into the database. This will not cause the serveraJ                startup to fail. These warning messages may be found in the"                server process log.  E                The server administration rule mapping facility allows K                arbitrary paths to be checked against the rule database. See                 Section 10.1.  N                                                             Mapping Rules  8-1                 I                Any changes to the mapping file may be (re)loaded into the M                running HTTPd server using the following command on the server                 system:  !                   $ HTTPD /DO=MAPr  ;                Also see Chapter 6 for daemon configuration.   $             8.1 Server Mapping Rules  M                A server's currently loaded mapping rules may be interrogated.i6                See Chapter 10 for further information.               8.2 Rulesa  $                MAP, PASS, FAIL Rules  %                1. map template result   F                   If the URL path matches the template, substitute theJ                   result string for the path and use that for further ruleM                   processing. Both template and result paths must be absolutep(                   (i.e. begin with "/").                  2. pass templatet&                   pass template result2                   pass template "999 message text"  F                   If the URL path matches the template, substitute theL                   result if present (if not just use the original URL path),.                   processing no further rules.  J                   The result should be a either a physical VMS file systemL                   specification in URL format or an HTTP status-code messageJ                   (see below). If there is a direct correspondance betweenD                   the template and result the result may be omitted.  I                   The PASS directive is also used to reverse-map VMS file C                   specifications to the URL path format equivalent.o  J                   An HTTP status-code message can be provided as a result.L                   The server then generates a response corresponding to thatJ                   status code containing the supplied message. Status-codeG                   results should be enclosed in one of single or double M                   quotes, or curly braces. See examples. A 3nn status resultstL                   in a redirection response with the message text comprisingM                   the location. Codes 4nn and 5nn result in an error message.tM                   Other code ranges (e.g. 0, 1nn, 2nn, etc.) simply cause the K                   connection to be immediately dropped, and can be used for ;                   that purpose (i.e. no indication of why!)                   3. fail templatea               8-2  Mapping Rules -  r            H                   If the URL path matches the template, prohibit access,H                   processing no further rules. The template path must be1                   absolute (i.e. begin with "/").                     REDIRECT Rule  *                1. redirect template result  M                   If the URL path matches the template, substitute the resulteK                   string for the path. Process no further rules. The resulteG                   must be a full URL (http://host/path), and is used toqI                   redirect requests to another server on a separate host.e  4                EXEC and SCRIPT, Script Mapping Rules                   EXEC+ and SCRIPT+  #                Also see Chapter 11.   I                The EXEC and SCRIPT directives have the variants EXEC+ and G                SCRIPT+. The variants behave in exactly the same fashion H                and simply mark the rule as representing a CGIplus scriptI                environment. See Section 11.6. Caution!  If changing ruleseK                involving these variants it is advised to restart the servertK                rather than reload. Some conflict is possible when using new B                rules while existing CGIplus scripts are executing.  :                The EXEC rules maps CGI script directories.  J                The SCRIPT rules maps CGI script file names. It is a littleM                different to the EXEC rule and an extension to the CERN rules.y  L                Both rules must have a template and result, and both must endM                in a wildcard asterisk. The placement of the wildcards and the K                subsequent functionality is slightly different however. Both4J                template and result paths must be absolute (i.e. begin with                "/").  &                1. exec template result  I                   The EXEC rule requires the template's asterisk to imme- J                   diately follow the slash terminating the directory spec-K                   ification containing the scripts. The script name follows I                   immediately as part of the wildcard-matched string. For                    example:  4                      exec /htbin/* /ht_root/script/*  K                   If the URL path matches the template, the result, includ-oM                   ing the first slash-terminated part of the wildcard-matchednL                   section, becomes the URL format physical VMS file specifi-K                   cation for the DCL procedure of the script to be executedpL                   (the default file extension of .COM is not required). What  N                                                             Mapping Rules  8-3 z  e            M                   remains of the original URL path is used to create the path 8                   information. Process no further rules.  H                   Hence, the EXEC rule will match multiple script speci-H                   fications without further rules, the script name beingK                   supplied with the URL path. Hence any script (i.e. proce-sM                   dure, executable) in the specified directory is accessable,oJ                   a possible security concern if script management is dis-                   tributed.f  (                2. script template result  E                   The SCRIPT rule requires the template's asterisk tonF                   immediately follow the unique string identifying theL                   script in the URL path. The wildcard-matched string is theJ                   following path, and supplied to the script. For example:  :                      script /conan* /ht_root/script/conan*  J                   If the URL path matches the template, the result becomesL                   the URL format physical VMS file specification for the DCLJ                   procedure of the script to be executed (the default fileI                   extension of .COM is not required). What remains of theeK                   original URL path is used to create the path information.s+                   Process no further rules.   4                                                 Note  E                         The wildcard asterisk is best located immedi-rD                         ately after the unique script identifier. InC                         this way there does not need to be any path F                         supplied with the script. If even a slash fol-C                         lows the script identifier it may be mapped H                         into a file specification that may or may not be1                         meaningful to the script.g  M                   Hence, the SCRIPT rule will match only the script specifiedTL                   in the result, making for finely-granular scripting at theK                   expense of a rule for each script thus specified. It also J                   implies that only the script name need precede any other#                   path information.   I                   It may be thought of as a more efficient implementationbI                   of the equivalent functionlity using two CERN rules, as 7                   illustrated in the following example:   /                      map /conan* /script/conan* 5                      exec /script/* /ht_root/script/*                  8-4  Mapping Rules                 #             8.3 Rule Interpretationv  K                The rules are scanned from first towards last, until a pass,bL                exec or fail is encountered, when processing ceases and finalM                substitution occurs. Mapped rules substitute the template witha8                the result and continue to the next rule.  7                Use of wildcards in template and result:   E                o  The template may contain one or more asterisk ("*") J                   wildcard symbols. These match zero or more characters upH                   until the character following the wildcard (or end-of-M                   string). If no wildcard is present then the path must match '                   the template exactly.n  L                o  The result may contain one or more asterisk ("*") wildcardF                   symbols. It must not contain more wildcards than theL                   template. The result wildcards are expanded to replace theK                   matching characters of the respective template wildcards. I                   Characters represented by wildcards in the template nottG                   represented by a corresponding wildcard in the resulttJ                   are ignored. Non-wildcard result characters are directlyI                   inserted in reconstructed path. Non-wildcard characters H                   in the template are ignored. If the result contains no@                   wildcards it completely replaces the URL path.                8.4 Mapping Examples  M                The example mapping rule file for the WASD HTTPd server can ber                viewed.  &                <online hypertext link>  "                Example of Map Rule  L                The result string of these rules may or may not correspond toK                to a VMS physical file system path. Either way the resultingoC                rule is further processed before passing or failing.e  I                1. The following example shows a path "/web/unix/shells/c"eK                   being mapped to "/web/software/unix/scripts/c", with thish6                   being used to process further rules.  9                      map /web/unix/* /web/software/unix/*             N                                                             Mapping Rules  8-5                 $                Examples of Pass Rule  M                The result string of these rules should correspond to to a VMSh"                physical file path.  M                1. This example shows a path "/web/rts/home.html" being mappedcH                   to "/user$rts/web/home.html", and this returned as the                   mapped path.  4                      pass /web/rts/* /user$rts/web/*  T                2. This maps a path "/icon/bhts/dir.gif" to "/web/icon/bhts/dir.gif",7                   and this returned as the mapped path.p  7                      pass /icon/bhts/* /web/icon/bhts/*   I                3. This example illustrates HTTP status code mapping. Each K                   of these does basically the same thing, just using one of K                   the three possible delimiters according to the characters E                   required in the message. The server generates a 403 M                   response with has as it's text the following message. (Also 8                   see the conditional mapping examples.)  =                      pass /private/* "403 Can't go in there!"gE                      pass /private/* '403 "/private/" is off-limits!'tD                      pass /private/* {403 Can't go into "/private/"}  $                Examples of Fail Rule  L                1. If a URL path "/web/private/home.html" is being mapped the3                   path would immediately be failed.e  (                      fail /web/private/*  H                2. To ensure all access fails, other than that explicitlyF                   passed, this entry should be included the the rules.                        fail /*  0                Examples of Exec and Script Rules  H                1. If a URL path "/htbin/ismap/web/example.conf" is beingM                   mapped the "/ht_root/script/" must be the URL format equiv- K                   alent of the physical VMS specification for the directorysL                   locating the script DCL procedure. The "/web/example.conf"J                   that followed the "/htbin/ismap" in the original URL be-J                   comes the translated path for the script. See Chapter 115                   for other information on scripting.   4                      exec /htbin/* /ht_root/script/*               8-6  Mapping Rules    A            L                2. If a URL path "/conan/web/example.hlb" is being mapped theK                   "/ht_root/script/conan" must be the URL format equivalenteJ                   of the physical VMS specification for the DCL procedure.K                   The "/web/example.hlb" that followed the "/conan/" in the J                   original URL becomes the translated path for the script.D                   See Chapter 11 for other information on scripting.  :                      script /conan* /ht_root/script/conan*  '                Example of Redirect Rule   D                1. If a URL path "/AnotherGroup/this/that/other.html"@                   is being mapped the URL would be redirected to4                   "http://host/this/that/other.html"  A                      redirect /AnotherGroup/* http://host/group/*p  #             8.5 Conditional Mapping   H                The purpose of conditional mapping is to apply rules onlyK                after certain criteria other than the initial path match are M                met. These criteria serve to create conditional mapping rules, 2                and were introduced in version 4.4.  G                THIS OFFERS A POWERFUL TOOL TO THE SERVER ADMINISTRATOR!e  L                Conditional mapping can be applied on the following criteria:  )                o  client internet addressa  +                o  browser-prefered language   0                o  browser-accepted content-types  /                o  browser identification stringt  +                o  authenticated remote user   /                o  HTTP method (GET, POST, etc.)e                  o  server namep                  o  server port   I                Note that path authorization is always applied to the path H                supplied with the request, not to the results of any ruleL                mapping that may have occured! This means authorization pathsM                may be administered without any ambiguity being implied by anyl+                rule mapping that may occur.s  I                Conditionals must follow the rule and are delimited by "[" L                and "]". Multiple, space-separated conditions may be includedI                within one "[...]". This behaves as a logical OR (i.e. the M                condition only needs one matched to be true). Multiple "[...]"mH                conditionals may be included against a rule. These act asG                a logical AND (i.e. all must have at least one condition   N                                                             Mapping Rules  8-7 i               F                matched). If a condition begins with a "!" it acts as aH                negation operator (i.e. matched strings result in a falseL                condition, unmatched strings in a true condition). The resultL                of an entire conditional may also be negated by prefixing the                "[" with a "!".  L                If a conditional, or set of conditionals, is not met the rule%                is completely ignored.a  C                Matching is done by simple, case-insensitive, stringvH                comparison, using the wildcards "*", matching one or moreB                characters, and "%", matching any single character.  J                White-space (spaces and TABs), wildcards and the delimitingG                "[" and "]", are forbidden characters and cannot be usedeM                within condition matching strings, nor can they be encoded for M                inclusion in any way (for simplicity and speed of processing). M                These characters are uncommon in the information being matched L                against, but if one does occur then "match" it using a single(                character wildcard ("%").  M                While conditionals are powerful adjuncts to smart serving they M                do add significant overhead to rule mapping and should be usedh!                with this in mind.r                  Conditionals   I                o  ac: - browser-accepted content types ("Accept:" request                    header field)   F                o  al: - browser-accepted languages ("Accept-Language:"'                   request header field)m  =                o  ho: - browser host internet name or address   +                o  me: - request HTTP methode  #                o  sn: - server namel  #                o  sp: - server ports  6                o  ru: - authenticated remote user name  D                o  ua: - browser ("User-Agent:" request header field)                  Examples   C                NOTE: It is possible to spoof (impersonate) internetlH                host addresses. Therefore any controls applied using hostL                name/address information cannot be used for security purposes2                in the strictest sense of the term.  J                1. The following example shows a rule being applied only ifH                   the client host is within a particular subnet. This is               8-8  Mapping Rules    h            M                   being used to provide a "private" home page to those in theUM                   subnet while others get a "public" page by the second rule.r  =                      pass / /web/internal/ [ho:131.185.250.*]a!                      pass / /web/t  E                2. This is a similar example to the above, but showingVI                   multiple host specifications and specifically excludingtK                   one particular host using the negation operator "!". ThislK                   could be read as pass if ((host OR host) AND (not host)).h  ]                      pass / /web/internal/ [ho:*.fred.com ho:*.george.com] [!ho:you.fred.com] !                      pass / /web/f  E                3. The next example shows how to prevent browsing of aeG                   particular tree except from specified host addresses.h  U                      pass /web/internal/* /web/SorryNoAccess.html [!ho:131.185.250.*] )                      pass /web/internal/*   F                   This could be used to prevent browsing of the serverE                   configuration files (an alternative to this sort of L                   approach is to use the authorization file, see Chapter 9).  X                      pass /ht_root/local/* /web/SorryNoAccess.html [!ho:131.185.250.201]  J                4. This example performs much the same task as the previousE                   one, but uses whole conditional negation to prevent.E                   browsing of a particular tree except from specified1H                   addresses (as well as using the continuation characterM                   to provide a more easily comprehended layout . . . note theeM                   trailing spaces as required). This could be read as pass ifh-                   not (host OR host OR host).e  C                      pass /web/internal/* /web/SorryNoAccess.html \                       ![\'                      ho:131.185.250.* \S'                      ho:131.185.251.* \ &                      ho:131.185.45.1 \-                      ho:ws2.wasd.dsto.gov.au\                       ])                      pass /web/internal/*   F                5. This example demonstrates mapping pages according toI                   geography or language preference (it's a bit contrived,e                   but . . . )e  B                      pass /doc/* /web/doc/french/* [ho:*.fr al:fr]C                      pass /doc/* /web/doc/swedish/* [ho:*.se al:se] 3                      pass /doc/* /web/doc/english/*   N                                                             Mapping Rules  8-9 R               K                6. How to exclude specific browsers from your site (how manyl+                   times have we seen this!)   N                      # I had to pick on a well-known acronym, no offence Bill!=                      pass /* /web/NoThankYou.html [ua:*MSIE*]n  E                7. This example allows excluding certain requests fromeL                   specific addresses. This could be read as pass if ((method+                   is POST) AND (not host)).   J                      pass /* /web/NotAllowed.html [me:POST] [!ho:*.my.net]  H                8. The following illustrates using the server name and/orG                   server port to conditionally map servers executing onrG                   clustered nodes using the same configuration file, ortI                   for multi-homed/multi-ported hosts. Distinct home pages I                   are maintained for each system, and on BETA two serverstJ                   execute, one on port 8000 that may only be used by those=                   within the specified network address range.   C                      pass / /web/welcome_to_Alpha.html [sn:alpha.*] I                      pass / /web/welcome_to_Beta.html [sn:beta.*] [sp:80] [                      pass /* /sorry_no_access.html [sn:beta.*] [sp:8000] [!ho:*.my.sub.net] S                      pass / /web/welcome_to_Beta_private.html [sn:beta.*] [sp:8000]   G                9. Each of these three do basically the same thing, just F                   using the three possible delimiters according to theJ                   characters required in the message. The server generatesM                   a 403 response with has as it's text the following message.p  P                      pass /private/* "403 Can't go in there!" [!ho:my.host.name]X                      pass /private/* '403 "/private/" is off-limits!' [!ho:my.host.name]W                      pass /private/* {403 Can't go into "/private/"} [!ho:my.host.name]c  G                Note that rule processing for any particular path may bel<                checked using the server administration menu.  @             8.6 Mapping User Directories (tilde character ("~"))  C                This server will map user directories using the samehC                mechanisms as for any other. No reference is made torI                SYSUAF.DAT, user support is accomplished via a combinationcJ                of mapping rule and logical name. This approach relies on aI                correspondance between the username and the home directorysF                name. Hence users are made known by the HTTPd using theG                name of their top-level directory. As the naming of homeLG                directories using the username is a common practice this M                mechanism should suffice in the majority of cases. Where there K                is no such correspondance individual rules could be used for                 each user.                8-10  Mapping Rules                  I                The PASS rule provides a wildcard representation of users'pF                directory paths. As part of this mapping a subdirectoryM                specifically for the hypertext data should be always included.pF                Never map users' top-level directories. For instance ifF                a user's account home directory was located in the areaL                USER$DISK:[DANIEL] the following rule would potentially allowM                the user DANIEL to provide hypertext information from the homehI                subdirectory [.WWW] (if the user has created it) using the                  accompanying URL:  /                   pass /~*/* /user$disk/*/www/*m  &                   http://host/~daniel/  H                It is recommended that a separate logical name be createdJ                for locating user directories. This helps hide the internalJ                organisation of the file system. The following logical nameA                definition and mapping rule illustrate this point.   W                   $ DEFINE /SYSTEM /EXEC /TRANSLATION=CONCEALED WWW_USER device:[USER.]f  .                   pass /~*/* /www_user/*/www/*  G                Where users are grouped into different areas of the file ;                system a logical search list may be defined.a  A                   $ DEFINE /SYSTEM /EXEC /TRANSLATION=CONCEALED - %                            WWW_USER -l-                            DISK1:[GROUP1.], -a-                            DISK1:[GROUP2.], - -                            DISK2:[GROUP3.], -o*                            DISK2:[GROUP4.]  .                   pass /~*/* /www_user/*/www/*  J                As logical search lists have specific uses and some compli-J                cations (e.g. when creating files) this is the only use forM                them recommended with this server, although it is specificallyIJ                coded to allow for search lists in document specifications.  H                If only a subset of all users are to be provided with WWWH                publishing access either their account directories can beL                individually mapped (best used only with a small number) or aL                separate area of the file system be provided for this purpose5                and specifically mapped as user space.   D                Of course, user mapping is amenable to all other ruleK                processing so it is a simple matter to redirect or otherwise L                process user paths. For instance, the published username doesJ                not need to, or need to continue to, correspond to any realA                user area, or the user's actual name or home area:h  N                                                            Mapping Rules  8-11 i  o            @                   redirect /~doej/* http://a.nother.host/~doej/*;                   pass /~doej/* /www/messages/deceased.htmll>                   pass /~danielm/* /special$www$area/danielm/*?                   pass /~Mark.Daniel/* /user$disk/danielm/www/* .                   pass /~*/* /www_user/*/www/*  L                A user directory is always presented as a top-level directoryM                (i.e. no parent directory is shown), although any subdirectory .                tree is accesssable by default.                                                                                               8-12  Mapping Rulesl t  g                M             Chapter__9_______________________________________________________   ,             Authentication and Authorization    7                COULD DO WITH MORE REVISION/INFORMATION!e  G                Authentication is the verification of a user's identity, M                usually through a username/password combination. AuthorizationaJ                is allowing a certain action based on authentication of the                originator.  D                The term authorization scheme refers to the method ofH                authenticating the user. The WASD HTTPd can employ one orG                other, or both of the "Basic" and "Digest" schemes. BothoK                schemes use a username/password mechanism, with Digest beingrL                preferable because the password is transmitted encrypted, and'                with Basic only encoded.   1                                              Note   E                      The Digest scheme has, to date, only been testedaH                      against NCSA X Mosaic 2.7-4b, which seems to behaveG                      a little flakey when reloading documents, and doesa8                      not elegantly support stale nonces.  I                For the WASD HTTPd user authentication can be done via theaI                server system's SYSUAF information (not recommended except K                in the most secure of LAN environments) (see Section 9.7 forsM                further information), or using databases specific to the HTTPdcH                environment. The authentication environment is termed theI                realm, and refers to a grouping of username/passwords as as                database.  J                Authorization is controlled using a configuration file, andF                is based on per-path directives. There is no user-levelF                authorization configuration necessary, or possible! TheH                authorization environment is termed the group, and refersL                to a group of usernames and associated permissions. Paths areJ                authorized on a per-group basis. Path access can be furtherK                restricted on an internet host name/domain, internet addressp3                and/or authenticated username basis.a  L                AUTHORIZATION IS ALWAYS APPLIED TO THE PATH SUPPLIED WITH THEL                REQUEST, not to the results of any rule mapping that may haveJ                occured! This means authorization paths may be administered!                without ambiguity."  N                                          Authentication and Authorization  9-1 s  p            L                With requests containing a script, authorization is performedF                on both script and path components. First script accessH                is checked for any authorization, then the path componentC                is independently authorized. Either may result in and%                authorization failure.o  E                Generally, authorization is a two step process. First, H                authentication, using a username/password realm database.D                Second, authorization, looking up a group database toG                determine what the username is allowed to do within that F                group. It is possible to use the same database for both0                authentication and authorization.  *             9.1 Permissions, Path and User                  Path Permissionse  L                Here the term permission is used to describe a path's abilityF                to be read from and/or written to. When a configurationK                directive is made against a path the DELETE, GET, HEAD, POST I                and PUT permissions associated with it control the type ofnH                access that may be made. This is used in conjunction withK                user permissions (see User Permissions) to determine whether K                the request can actually perform the HTTP method it was made J                with. The allowed action is the logical AND of the path andM                user permissions. The abbreviations R, W, and R+W allow a more                  concise notation.  M                ______________________________________________________________ M                Path/User___DELETE_GET____HEAD___POST___PUT___________________   9                READ or R   no     yes    yes    no     no   :                WRITE or W  yes    no     no     yes    yes  :                R+W         yes    yes    yes    yes    yes  9                DELETE      yes    yes    no     no     noi  9                GET         no     yes    no     no     no   9                HEAD        no     no     yes    no     noo  9                POST        no     no     no     yes    no   M                PUT_________no_____yes____no_____no_____yes___________________o                  User Permissions   L                The term permissions is used to describe a username's abilityH                to read and/or write within paths configured against thatF                group. Read permission is technically GET and HEAD HTTPH                methods, write permission POST and PUT methods. AssigningL                permissions against usernames can allow some within the group  1             9-2  Authentication and Authorizationn s  v            G                read-only access, while others have update capabilities. J                This is used in conjunction with path permissions (see PathI                Permissions) to determine whether the request can actually 8                perform the HTTP method it was made with.    3             9.2 Databases, Authentication and Groups  &                Authentication Database  K                The authentication, or realm database contains usernames and H                associated passwords. Passwords are always verified usingI                this database. In addition, this database can contain per- I                user permissions, that control access to configured paths. E                In this role it acts as both realm and group database.nJ                Passwords are stored encrypted. Warning ... if using DigestI                authentication an authentication database cannot be simplywM                renamed to represent a group-name change, as the database name 6                is encrypted as part of the MD5 Digest!                  Group Database   I                The permissions, or group database, contains usernames andaF                their associated permissions within the group. That is,G                can that user read and/or write paths configured against F                that group. A group database is never used for password-                verification (authentication).   H                A group database is not always necessary. If only a smallL                number of users must the authorized against a given path theyH                can be specified individually using a "~username" format.  0             9.3 Authorization Configuration File  M                By default, the system-table logical name HTTPD$AUTH locates a L                common authorization configuration file, unless an individualL                rule file is specified using a job-table logical name. SimpleK                editing of the file changes the configuration. Comment linesUM                may be included by prefixing them with the hash "#" character,rL                and lines continued by placing the backslash character "\" as,                the last character on a line.  E                Configuration directives begin either with a "[realm]"uK                specification, or the forward-slash of a path specification. H                Following the path specification are HTTP method keywordsK                controlling group and world permissions to the path, and any B                access-restricting host address(es) or username(s).  H                o  REALM -  Square brackets are used to enclose a [realm]K                   specification, introducing a new authentication grouping.eM                   Within these brackets is specified the realm (and database)rF                   name, and then an optional group name separated by a  N                                          Authentication and Authorization  9-3                 H                   semi-colon. All path specifications following this areE                   authenticated against the specified realm database, F                   and permissions obtained from the group database (orH                   authentication database if group not specified), until1                   the next [realm] specification.u  H                o  PATH -  Paths are usually specified terminated with anI                   asterisk wildcard. This implies that any directory treelI                   below that is included in the access control. WildcardsaL                   may be used to match any portion of the specified path, orJ                   not at all. Following the path specification are controlL                   keywords representing the HTTP methods that can be appliedH                   against the path, and optional access-restricting listI                   of host address(es) and/or username(s), separated using8L                   commas. Access control is against either or both the groupM                   and the world. The group access is specified first followedeM                   by a semi-colon separated world specification. See examplesg(                   to clarify the format.                  Reserved Realms  F                The following realm names are reserved and have special                functionality./  G                1. EXTERNAL -  Any authentication and authorization willsH                   be done in some way by an external CGI script. None is*                   attempted by the server.  J                2. WORLD -  This refers to any request and is not authenti-H                   cated in any way, only the permissions associated withL                   the path are applied to the request. The reserved username;                   world becomes the authenticated username.e  M                3. VMS -  Use the VMS system's SYSUAF database to authenticatehJ                   the username. As username/password pairs are transmittedJ                   encoded but not encrypted this is not recommended exceptG                   in the most secure of LAN environments. Accounts withnI                   SYSPRV authorized are always rejected to discourage theuG                   transmission of unencrypted passwords for potentiallyfH                   significant usernames (e.g. SYSTEM). Accounts that areI                   disusered, have passwords that have expired or that arewH                   captive or restricted are also automatically rejected.  J                   The ability to authenticate using the system's SYSUAF isK                   controlled by the server /SYSUAF qualifier. By default it                    is disabled.  :                   See Section 9.7 for further information.    1             9-4  Authentication and Authorization. s  n                             Reserved Username  2                The following username is reserved.  L                1. WORLD -  If a path is authorized using the WORLD realm theK                   pseudo-authenticated username becomes WORLD. Any log will M                   reflect this username and scripts will access a WWW_REMOTE_0K                   USER containing this value. Although not forbidden, it is L                   not recommended this string be used as a username in other                   realms.   &                Access Restriction List  L                If a host name or username is included in the path configura-M                tion directive it acts to limit access to matching clients. IfaL                both are included a request must match both. If multiple hostK                names and/or usernames are included the client must match at M                least one of each. Strings may contains the asterisk wildcard,iH                matching one or more consecutive characters. This is mostI                useful when restricting access to all hosts within a given                 domain, etc.p  I                o  Host Names -  may be specified as either alphabetic (ifeG                   DNS resolution is enabled) or numeric addresses. WhenHH                   a host restriction occurs there is never an attempt toK                   authenticate any associated username. Hence applying hostcG                   restrictions very effectively prevents an attack fromsM                   outside the allowed addresses. The reserved word #localhostlE                   refers to the host name the server is executing on.   J                o  User Names -  are indicated by a leading circumflex, theA                   "~" character (similar or username URL syntax).f                  For example  G                   /web/secret/* *.three.stooges,~Moe,~Larry,~Curly,readd  K                restricts read access to Curly, Larry and Moe accessing from 0                within the three.stooges network.  4             9.4 Authorization Configuration Examples  M                1. In the following example the authentication realm is "WASD" G                   and the permissions group "SOCIALCLUB". The directive(K                   allows those authenticated from the WASD realm and in the L                   SOCIALCLUB group to read and write, and the world to read.  &                      [WASD;SOCIALCLUB]1                      /web/socialclub/* r+w ; read   N                                          Authentication and Authorization  9-5 o  n            G                2. This example illustrates restricting access according H                   internet address. Both the group and world restrictionH                   is identical, but the group address is being specifiedH                   numerically, while the world access is being specifiedH                   alphabetically. This access check is done doing simpleI                   wildcard comparison, and makes numerical specificationsOE                   potentially more efficient because they are usually M                   shorter. The second line restricts that path's write access :                   even further, to one username, "BLOGGS".  &                      [WASD;SOCIALCLUB]W                      /web/socialclub/* 131.185.45.*,get,post; *.dsto.defence.gov.au,getch                      /web/socialclub/accounts/* 131.185.45.*,~BLOGGS,get,post; *.dsto.defence.gov.au,get  M                3. In the following example the authentication realm and group L                   are a single database, "ADMIN". The first directive allowsK                   those in the ADMIN group to read and write, and the world K                   to read ("get,post;get"). The second line restricts write M                   and even read access to ADMIN group, no world access at all                    ("get,post").                         [ADMIN]1                      /web/everyone/* get,post;get /                      /web/select/few/* get,postn  J                4. This example usernames are used to control access to theM                   specified paths. These usernames are authenticated from theb#                   COMPANY database.n                        [COMPANY]>                      /web/docs/* ~Howard,~George,~Fred,r+w ; r4                      /web/accounts/* ~George,r+w ; r  I                5. The following example shows a path specifying the local K                   system's SYSUAF being used to authenticate any usernames. L                   Whenever using SYSUAF authentication it is strongly recom-K                   mended to limit the potential hosts that can authenticatesM                   in this way by always using a host-limiting access restric- 7                   tion list. The world get read access.v                        [VMS]<                      /web/local/area/* 131.185.250.*,r+w ; r  I                6. To restrict server administration to browsers executing J                   on the server system itself and the SYSUAF-authenticatedG                   username DANIEL use a restriction list similar to the_                   following.                        [VMS]=                      /httpd/-/admin/*  #localhost,~daniel,r+wM  1             9-6  Authentication and Authorizationc o  s            H                7. The following example illustrates providing a read andM                   writable area (GET, POST and PUTable) to hosts in the local F                   network without username authentication (carefull!).                        [WORLD];                      /web/scratch/*  *.local.hosts.only,r+w   3             9.5 Server Authorization Administrationo  L                The server authorization databases can be initially set-up by<                breaking-in to the server, see Section 9.5.1.  J                A server's currently loaded path authorization and user au-L                thentication information may be administered and interrogatedJ                on-line using the server administration facility. See Chap-)                ter 10 for further detail.   ,             9.5.1 Breaking-in To The Server!  K                The server's authentication/authorization environment can be J                circumvented under special circumstances. Note that this isM                not possible without administrator action and persists only asSF                long as the administrator actually performs the action!  K                This provision exists for only three foreseeable situations:i  I                1. initial configuration of the authentication environmenth  6                2. loss of the administrator's password  (                3. demonstration purposes                  Method   E                If performing the initial authentication configurationn  B                make_sure_the_HT_AUTH_logical_is_correctly_defined.  L                Manually start a new instance of the server on a non-standardM                port using the /PROMISCUOUS qualifier. This can be done at thenC                command-line. There is now a security hole. Example:s  .                   $ HTTPD = "HT_EXE:HTTPD.EXE"=                   $ SPAWN /WAIT HTTPD /PORT=8088 /PROMISCUOUSr  J                This will allow access using any username/password combina-J                tion. Access this instance of the server with a browser andH                use the server administration menu. It is now possible toL                create databases, enter username details, change the adminis-M                trator's password to something known, etc., etc. Shutdown that F                server again (ctrl-Y) and the security hole disappears.  N                                          Authentication and Authorization  9-7 t               *             9.6 User Password Modification  G                The server provides for users to be able to change theiroG                own passwords. This functionality, though desirable fromiE                the administrator's viewpoint, is not mandatory if the F                administrator is content to field any password changes,L                forgotten passwords, etc. Keep in mind that passwords, thoughG                not visible during entry, are passed to the server using &                clear-text form fields.  K                Password modification is enabled by including a mapping rules:                to the internal change script. For example:  7                   map /http/-/change/* /http/-/change/*   M                Any database to be enabled for password modification must haverM                a writable authorization path associated with it. For example:c                     [GROUP]d-                   /httpd/-/change/group/* r+w,  !                   [ANOTHER_GROUP]p5                   /httpd/-/change/another_group/* r+w   D                Use some form of cautionary wrapper if providing this                functionality:s  5                   <H2>Change Your Authentication</H2>   !                   <BLOCKQUOTE><I> `                   Change the password used to identify yourself to the REALM Web environment for`                   some actions.  Note that this <U>not</U> an operating system password, nor hasU                   it anything to do with it.  Due to the inherent weaknesses of using_^                   non-encrypted password transmissions on networks <FONT COLOR="#ff0000"><U>DO_                   NOT</U> use a password you have in use anywhere else, especially an operatingo`                   system password!</FONT> You need your current password to make the change.  Ifb                   you have forgotten what it is contact <A HREF="/web/webadmin.html">WebAdmin</A>,Q                   preferably via email, for the change to be made on your behalf. #                   </I></BLOCKQUOTE>                      <UL>G                   <LI><A HREF="/httpd/-/change/REALM/">REALM</A> realm.                    </UL>i  *             9.7 SYSUAF-Authenticated Users  G                The ability to authenticate using the system's SYSUAF is H                controlled by the server /SYSUAF qualifier. By default it                is disabled.   H                It is possible to control access to files and directoriesJ                based on the VMS security profile of a SYSUAF-authenticatedG                remote user. This functionality is implemented using VMS G                security system services involving SYSUAF and RIGHTSLISTi  1             9-8  Authentication and Authorization  h  r            H                information. The feature must be explicitly allowed usingH                the server /PROFILE qualifier. By default it is disabled.  K                Further warning ... SYSUAF authentication is not recommendedt=                except in the most secure of LAN environments.a  L                Note that this mechanism is applied after any path and methodE                assessment made by the server's authentication schema.   G                When a SYSUAF-authenticated user (i.e. the VMS realm) iscH                first authenticated a VMS security-profile is created andI                stored in the authentication cache. A cached profile is anrL                efficient method of implementing this as it obviously removesJ                the need of creating a user profile each time a resource isK                assessed. If this profile exists in the cache it is attachedgK                to each request authenticated for that user. As it is cachedgK                for a period, any change to a user's security profile in thesL                SYSUAF or RIGHTSLIST won't be reflected in the cached profileM                until the cache entry expires or it is explicitly flushed (seev                Section 10.3).   G                When a request has this security profile all accesses tonL                files and directories are assessed against it. When a file orM                directory access is requested the security-profile is employedlH                by a VMS security system service to assess the access. IfL                allowed, it is provided via the SYSTEM file protection field.K                Hence it is possible to be eligible for access via the OWNERaL                field but not actually be able to access it because of SYSTEMK                field protections! If not allowed, a "no privilege" error iso                generated.   I                Of course, this functionality only provides access for the E                server, IT DOES NOT PROPAGATE TO ANY SCRIPT ACCESS. If H                scripts must have a similar ability they should implementF                their own scheme (which is not too difficult, ) see HT_K                ROOT:[SRC.MISC]CHKACC.C) based on the CGI variable WWW_AUTH_tK                REALM which would be "VMS" indicating SYSUAF-authentication,d=                and the authenticated name in WWW_REMOTE_USER.-  .                Controlling Server Write Access  I                Write access by the server into VMS directories (using the K                POST or PUT HTTP methods) is controlled using VMS ACLs. This L                is in addition to the path authorization of the server itselfI                of course! The requirement to have an ACL on the directory M                prevents inadvertant mapping/authorization of a path resulting >                in the ability to write somewhere not intended.      N                                          Authentication and Authorization  9-9 a               A                Two different ACLs implement two grades of access.   M                1. If the ACL grants CONTROL access to the server account then I                   only VMS-authenticated usernames with security profiles K                   can potentially write to the directory. Only potentially,iL                   because a further check is made to assess whether that VMS9                   account in particular has write access.u  L                   This example shows a suitable ACL that applies only to the%                   original directory:c  3                      $ SET SECURITY directory.DIR -PC                        /ACL=(IDENT=HTTP$SERVER,ACCESS=READ+CONTROL)   J                   This example shows setting an ACL that will propagate to@                   created files and importantly, subdirectories:  3                      $ SET SECURITY directory.DIR - d                        /ACL=((IDENT=HTTP$SERVER,OPTIONS=DEFAULT,ACCESS=READ+WRITE+DELETE+CONTROL), -R                              (IDENT=HTTP$SERVER,ACCESS=READ+WRITE+DELETE+CONTROL))  G                2. If the ACL grants WRITE access then the directory cannG                   be written into by any authenticated username for the "                   authorized path.  L                   This example shows a suitable ACL that applies only to the%                   original directory:   3                      $ SET SECURITY directory.DIR -LA                        /ACL=(IDENT=HTTP$SERVER,ACCESS=READ+WRITE)   J                   This example shows setting an ACL that will propagate to@                   created files and importantly, subdirectories:  3                      $ SET SECURITY directory.DIR - \                        /ACL=((IDENT=HTTP$SERVER,OPTIONS=DEFAULT,ACCESS=READ+WRITE+DELETE), -J                              (IDENT=HTTP$SERVER,ACCESS=READ+WRITE+DELETE))  !                Performance Impacti  I                If the /PROFILE qualifier has enabled SYSUAF-authenticatedmJ                security profiles, whenever a file or directory is assessedF                for access an explicit VMS security system service callI                is made. This call builds a security profile of the objectMH                being assessed, compares the cached user security profileG                and returns an indication whether access is permitted oraJ                forbidden. This is addition to any such assessments made by1                the file system as it is accessed.l  I                This extra security assessment is not done for non-SYSUAF-b=                authenticated accesses within the same server.o  2             9-10  Authentication and Authorization .  s            L                For file access this extra overhead is negligible but becomesJ                more significant with directory listings ("Index of") whereG                each file in the directory is independently assessed fore                access.                                                                                            N                                         Authentication and Authorization  9-11                     M             Chapter__10______________________________________________________   !             Server Administration     H                All server configuration files, with the execption of theK                authentication databases, are plain text and may be modified I                with any prefered editor. However the majority of this can >                also be administered on-line through a browser.  K                A menu of server administration functions is provided by the                 server.  &                <online hypertext link>  K                In addition a Web Update facility allows some administrationwB                of file system portions of the Web. See Chapter 13.  K                If authorization is in use (see Chapter 9) it is recommendedeK                that the path to these reports be controlled via authentica-sL                tion and authorization, using both host and username restric-/                tions, similar to the following:   "                   [WHATEVER-REALM]L                   /httpd/-/admin/*  host.ip.addr,~WebMaster,~WhoEverElse,r+w  F                If a full authorization environment is not required butJ                administration via browser is still desired restrict accessJ                to browsers executing on the server system itself, using anJ                appropriate SYSUAF-authenticated username (start the server,                using the /SYSUAF qualifier):                     [VMS]r<                   /httpd/-/admin/*  #localhost,~username,r+w  %             10.1 HTTPd Server Reportse  L                The server provides a number of internally generated reports.  J                1. Statistics -  Server process up-time, CPU-time and otherF                   resources consumed, number of connections processed,L                   number of requests of each HTTP method, type of processingJ                   involved (HTTPd module used), number of bytes processed,                   etc.  L                2. Configuration -  A tabular summary of the server's currentL                   configuration. This is a convenient method for viewing the9                   information from the HTTPD$CONFIG file.g  M                3. Message -  A tabular report of the server's current messagerL                   database, multiple languages shown if configured that way.  N                                                    Server Administration  10-1                 K                4. Mapping -  All loaded mapping rules. In addition a query-aJ                   form interface allows the user to input a path and watch6                   the rules as the server resolves it.  G                5. Path Authorization -  If authorization is in use (see H                   Chapter 9) this report lists the paths with associated3                   authorization and access control.i  F                6. User Authentication -  List any users that have beenI                   authorized since the server was last started, the realmeH                   authorized from, the group it applies to (if any), andL                   what the user's capabilities are (allowed HTTP methods). AI                   time-stamp and counters provide additional information.a  J                7. Request -  Lists current requests (always shows at leastF                   your own connection accessing this report :^) and ifE                   enabled by configuration a history list of the most I                   recent requests. Enabled by the configuration parametere#                   [RequestHistory].f  H                8. Script -  Provides some DCL, CGI and CGIplus scripting                   information.  L                   o  DCL module statistics (same information as displayed inL                      the server statistics report). These are cumulative forC                      the entire life of the system (unless zeroed)./  M                   o  Subprocess information show how many actual subprocesseshN                      exist at the time of the report. The soft-limit specifiesN                      how many CGIplus scripts are allowed to continue existingM                      before the least used is deleted and the hard-limit showcM                      how many subprocesses may actually exist at any one time K                      (the margin allows for subprocess deletion latency). A J                      count of how many times the CGIplus subprocesses haveL                      been explicitly purged (button available on this reportJ                      page). The life-time of zombie processes (in minutes,M                      zero implying use of zombies is disabled) and the numbertL                      that have been purged due to expiry. CGIplus subprocessJ                      life-time (in minutes, zero implying indefinite), theL                      number purged due to life-time expiry and the number ofM                      CGIplus subprocesses that the server has actually purged J                      (deleted) to maintain the soft-limit margin specified                      above.   H                   o  Each of the allocated subprocess data structures isL                      listed. There may be zero up to hard-limit items listedM                      here depending on demand for DCL activities and the lifesM                      of the server. Items with a PID shown indicate an actual L                      subprocess existing. This can be a zombie subprocess orM                      a CGIplus subprocess. If no subprocess is indicated then M                      the other information represents the state the last time L                      the item's associated subprocess completed. Information  '             10-2  Server Administrationn t  i            I                      includes the script (URL-style path) or DCL command,tM                      total count of times the item has been used and the lastrJ                      time it was. The zombie count indicates the number ofL                      time the same subprocess finished a request and enteredM                      the zombie state. The CGIplus column indicates it is/wasnN                      a CGIplus script and shows the total number of times thatN                      particular script has been/was used. If the subprocess isL                      currently in use the client information show the client                      host name.l  E                   o  If any subprocesses are associated with any dataoI                      structure a purge button is provided that forces allsH                      subprocesses to be deleted. This can be useful if aH                      new script image is compiled and it is required allN                      scripts now use this. If a script is currently processingG                      a request the subprocess deletion occurs when thatoL                      processing is complete. The purge button does not forceJ                      a subprocess to delete, so a second button forces allI                      subprocesses to delete immediately. This can be usedoK                      to forceably clear errant scripts, etc., but be warnedrA                      script processing is indiscrimately stopped!   M                9. Activity -  Provide a graphical snapshot of server activity $                   of a given period.  F                   This is dynamic data, held in memory only, and so isD                   current only from the latest server startup. It isH                   enabled by the configuration parameter [ActivityDays].L                   The administration menu provides several, represented as aM                   period of hours before the present time. Number of requests M                   and bytes sent to the client are represented by a histogram L                   with respective means for each during the period by a lineK                   graph. A greyed area indicates no data available for thataH                   time (i.e. before the latest server startup, or in the                   future).  J                   Activity data is accumulated on a per-minute basis. ThisH                   is the maximum granularity of any report. When reportsI                   are selected that can display less than this one minute M                   granularity (i.e. with periods greater than four hours) theuJ                   value shown is the peak of the number of minutes sampledL                   for display. This better represents the load on the server5                   than would a mean of those samples.   M                   For browsers recognised as capable (with v4.3 of the servereK                   these are Netscape Navigator 3.0ff and Microsoft Internet I                   Explorer 3.02ff) this report is JavaScript-enabled, andhI                   if in focus the browser refreshes itself at an intervalpG                   appropriate to the reporting period. If not in focus, H                   the report is automatically refreshed when the browser-                   is brought back into focus.w  N                                                    Server Administration  10-3                 K                   The graph is an image map, various regions of which allow J                   the selection of other reports with different periods orK                   durations. This allows previous periods to be examined at J                   various levels of detail using the graph for navigation.L                   Various sections may have no mapping as appropriate to the!                   current report.'  H                   The following example shows the layout for a four hourD                   report. The upper and lower sections have distinctG                   functions. The middle 50% of the upper section allowshJ                   the same end time (most commonly the current hour) to beI                   examined over twice the current period, in this case ittM                   would be over eight hours. The left 25% allows the previous I                   fours hours to be viewed (if such data exists), and fortH                   non-current reports the right 25% allows the next fourH                   hours to be viewed. The lower half can be divided intoM                   sections representing hours or days depending on the periodeM                   of the current report. This allows that period to be vieweddM                   in greater detail. For single hour reports this section, ofe(                   course, is not mapped.  E                   Remember that the URL of the mapped section will betH                   displayed in the status bar of the browser. As the URLH                   contains time components it is not a difficult task toM                   decipher the URL displayed to see the exact time and periodn!                   being selected.   F                      +-----------+-----------------------+-----------+F                      | previous  |     same end time     | next      |F                      | 4 hours   |   double the period   | 4 hours   |F                      |           |                       |           |F                      |           |                       |           |F                      +-----------+-----------+-----------+-----------+F                      | hour 1    | hour 2    | hour 3    | hour 4    |F                      | period: 1 | period: 1 | period: 1 | period: 1 |F                      |           |           |           |           |F                      |           |           |           |           |F                      +-----------+-----------+-----------+-----------+    $             10.2 HTTPd Server Revise  M                The server provides a limited configuration revision facility.   E                1. Configuration -  A form-driven interface allows the G                   current configuration of the server to be altered on- K                   line. This configuration may then be saved to the on-disk K                   file and then the server could be restarted using the new I                   parameters. The source of the current configuration can L                   be either the server itself (from it's volatile, in-memory  '             10-4  Server AdministrationH C               H                   parameters) or from the on-disk configuration file. InI                   addition it is possible to directly edit and update theW                   on-disk file.   L                2. Message -  No form-driven interface is currently availableF                   for changing the messages. However it is possible toG                   directly edit and update the on-disk file. The servereI                   can then be restarted to use the modified database (seeu                    Section 10.3).  L                3. Mapping -  No form-driven interface is currently availableH                   for changing the mapping rules. However it is possibleK                   to directly edit and update the on-disk file. The mapping K                   rules could then be reloaded, changing the current serverd+                   rules (see Section 10.3).L  M                4. Path Authorization -  No form-driven interface is currentlytJ                   available for changing the path authorization configura-J                   tion. However it is possible to directly edit and updateK                   the on-disk file. The path authorization directives couldnL                   the be reloaded, changing the current server authorization%                   (see Section 10.3).   H                5. User Authentication -  User authentication comprises aM                   number of dialogues that allow the authentication databasesL4                   to be administered. These include:  '                   o  creating databases   '                   o  deleting databasesr  D                   o  accessing databases for administering usernames  7                   o  listing usernames within databasesS  %                   o  adding usernames   '                   o  deleting usernamesS  B                   o  modifying username permissions and other data  K                   o  reseting in-server (cached) authentication informationt  A                   Chapter Chapter 9 covers authentication detail.   $             10.3 HTTPd Server Action  J                The server allows certain run-time actions to be initiated.  J                1. Statistics Zeroed -  All counters are zeroed (except the2                   number-of-times-zeroed counter!)  M                2. Mapping Rules Reload -  Reloads the path mapping rules from ;                   the on-disk file into the running server.   N                                                    Server Administration  10-5 T  S            L                   Caution!  If changing CGIplus script mapping it is advisedI                   to restart the server rather than reload. Some conflict I                   is possible when using new rules while existing CGIplusm(                   scripts are executing.  M                3. Path Authorization Reload -  Reloads the path authorizationuK                   directives from the on-disk file into the running server.   K                4. User Authentication Cache Purge -  For efficiency reasons L                   authenticated user information is cached for a limited pe-M                   riod within the running server. All this cached informationsJ                   may be completely purged using this action, forcing sub-I                   sequent requests to be reauthenticated from the on-disk                    database.h                                                                        '             10-6  Server Administrationr l  c                M             Chapter__11______________________________________________________o               Scriptingw    K                Scripts are mechanisms for creating simple "servers" sending M                data to a client, extending the services provided by the basic H                server. Anything that can write to SYS$OUTPUT can be usedJ                to generate script output. A DCL procedure or an executableK                can be the basis for a script. Simply TYPE-ing a file can be %                provide script output.   H                Scripts are enabled using the exec or script rules in theM                mapping file (see Chapter 8). The script portion of the result H                must be a URL equivalent of the physical VMS procedure orJ                executable specification. It is not necessary to supply theJ                .COM or .EXE file type (although not forbidden either), theM                server will first check for a procedure and if none found thenW'                check for an executable.t               11.1 Caution!s  L                Scripts are executed within unprivileged subprocesses spawnedM                by the HTTPd server. These subprocesses are owned by the HTTPdsK                server account (HTTP$SERVER). Script actions can potentiallyoH                affect server behaviour. For example it is possible for aH                script to issue an "HTTPD/DO=ABORT" command, or to createJ                or modify logical name values in the JOB table (e.g. changeK                the value of LNM$FILE_DEV altering the logical search path).nL                Obviously these types of actions are undesirable. In additionJ                scripts can access any WORLD-readable and modify any WORLD-H                writable resource in the system/cluster, opening a windowG                for information leakage or mischievous/malicious actionshL                (some might argue that anyone with important WORLD-accessableJ                resources on their system deserves all that happens to themK                - but we know they're out there :^) Script authors should beaL                aware of any potential side-effects of their scripts, and WebL                administrators vigilant against possible malicious behaviours-                of scripts they do not author.e  H                As of version 4.2 it has become possible to exercise someL                control over the privileges of spawned subprocesses, allowingJ                enviroments that require scripts to have minimum privilegesM                (e.g. NETMBX, TMPMBX for IPC) to provide them using the serverb>                account's authorized privileges. See Chapter 6.      N                                                                Scripting  11-1                 &             11.2 Scripting Environment  K                WASD HTTPd scripting underwent a major redesign between v4.1iH                and v4.2. This was to provide a faster and more efficientL                scripting environment. It provided the opportunity for a muchI                needed review of the DCL mechanism within the server. As a K                result two capabilities not found in earlier versions became I                available, persistant subprocesses (see below) and CGIplust"                (see Section 11.6).  M                Process creation under the VMS operating system is notoriously G                slow and expensive. This is an inescapable overhead when D                scripting via child processes. An obvious strategy isF                to avoid, at least as much as possible, the creation ofM                subprocesses. The only way to do this is to share subprocesses J                between multiple scripts/requests, addressing the attendantH                complications of isolating potential interactions betweenM                requests. These could occur through changes made by any script J                to the subprocess' enviroment. For VMS this involves symbolL                and logical name creation, and files opened at the DCL level.K                In reality few scripts need to make logical name changes and L                symbols are easily removed between uses. DCL-opened files areL                a little more problematic, but again, in reality most scripts6                doing file manipulation will be images.  J                A reasonable assumption is that for almost all environmentsM                scripts can quite safely share subprocesses with great benefitiJ                to response latency and system impact (see Section 12.2 forH                a table with some comparative performances). If the localM                environment requires absolute script isolation for some reasondM                then this subprocess-persistance may easily be disabled with as3                consequent trade-off on performance.y  H                NOTE: With the form of subprocess management used in v4.2I                and following, BYTLM can become an issue. When setting thegI                HTTPd account BYTLM quota allow approxiamtely 12,500 byteseM                per subprocess that can be concurrently active, plus a general(H                allowance (technically, allow 1.0 x /NETBUF= plus 1.0 x +L                0.5 x + 0.5 x /SUBBUF=). That is if the subprocess hard-limitM                (see below) is 20 then BYTLM should be set to at least 250,000)K                plus 50,000. Of course in such a case PRCLM should be set to J                at least 20, preferably 40. These and other relevant quotasH                may be monitored using the HTTPDMON utility or the server#                administration menu.                          11-2  Scriptings                                 Zombies  D                The term zombie is used to describe subprocesses whenJ                persisting between uses (the reason should be obvious, theyM                are neither "alive" (processing a request) nor are they "dead"iL                (deleted) :^) Zombie subprocesses have a finite time to existI                (non-life-time?) before they are automatically purged fromAL                the system (see Chapter 6). This keeps process clutter on the#                system to a minimum.                11.3 CGI Compliancee  F                The HTTPd scripting mechanism is designed to be WWW CGIL                (Common Gateway Interface) compliant, based in part on by theL                INTERNET-DRAFT authored by D.Robinson (drtr@ast.cam.ac.uk), 8                January 1996.  &                CGI Compliant Variables  H                Environment variables are created in a similar way to theM                CERN VMS HTTPd implementation, where CGI environment variablesrJ                are provided to the script via DCL global symbols. Each CGIH                variable symbol name is prefixed with "WWW_" (by default,L                although this can be changed using the /CGI_PREFIX qualifier,G                see Section 5.3, this is not recommended if the WASD VMSeJ                scripts are to be used, as they expect CGI variable symbols.                to be prefixed in this manner).  *                Extensions to CGI Variables  F                In line with other CGI implemenations, additional, non-H                compliant variables are provided to ease CGI interfacing.J                These provide the various components of the query string. AK                keyword query string and a form query string are parsed into )                separated variables, nameds                      WWW_KEY_number                   WWW_KEY_COUNTi,                   WWW_FORM_form-element-name  %                See the example below.t  $                CGI Variable Capacity  J                DCL symbol values are limited to approximately 1000 charac-J                ters. The CGI interface will provide symbols with values upL                to that limit if required. This should be sufficient for most                circumstances.i    N                                                                Scripting  11-3 e  e            (                CGI Variable Descriptions  >                Remember, all variables are prefixed by "WWW_".  M                ______________________________________________________________ M                Name__________________Description___________"Standard"_CGI____   =                AUTH_GROUP            authentication group  noe/                                      (or empty)   =                AUTH_REALM            authentication realm  no /                                      (or empty)t  >                AUTH_TYPE             authentication type   yes6                                      (BASIC or DIGEST)  >                CONTENT_LENGTH        "Content-Length:"     yes8                                      from request header  >                CONTENT_TYPE          "Content-Type:" from  yes3                                      request headert  =                FORM_field            query string "&"      nop3                                      separated forms-                                      elementst  >                GATEWAY_INTERFACE     "CGI/1.1"             yes  >                HTTP_ACCEPT           list of browser-      yes5                                      accepted contentt*                                      types  >                HTTP_ACCEPT_LANGUAGE  list of browser-      yes7                                      prefered languages   >                HTTP_AUTHORIZATION    line from request     yes+                                      header   >                HTTP_COOKIE           any cookie sent by    yes/                                      the clients  >                HTTP_IF_NOT_MODIFIED  GMT time string       yes  >                HTTP_PRAGMA           any pragma directive  yes6                                      of request header  >                HTTP_REFERER          source document URL   yes5                                      for this request   >                HTTP_USER_AGENT       client/browser        yes3                                      identificationv+                                      stringm               11-4  Scriptinga w             M                ______________________________________________________________ M                Name__________________Description___________"Standard"_CGI____   =                KEY_n                 query string "+"      no 7                                      separated elementst  =                KEY_COUNT             number of "+"         no 7                                      separated elementsd  >                PATH_INFO             virtual path of data  yes5                                      requested in URL   >                PATH_TRANSLATED       VMS file path of      yes6                                      data requested in(                                      URL  >                QUERY_STRING          un-URL-decoded        yes5                                      string following /                                      "?" in URLs  >                REMOTE_ADDR           IP host address of    yes0                                      HTTP client  >                REMOTE_HOST           IP host name of HTTP  yes+                                      client-  >                REMOTE_USER           authenticated remote  yes9                                      user name (or empty)   >                REQUEST_METHOD        "GET", "PUT", etc.    yes  =                REQUEST_TIME_GMT      GMT time request      no -                                      received   =                REQUEST_TIME_LOCAL    Local time request    no--                                      received   >                SCRIPT_NAME           name of script        yes9                                      being executed (e.g.1.                                      "/query")  >                SERVER_NAME           IP host name of       yes2                                      server system  >                SERVER_PROTOCOL       HTTP protocol         yes9                                      version ("HTTP/1.0")r  >                SERVER_PORT           IP port request was   yes0                                      received on  >                SERVER_SOFTWARE       software ID of HTTP   yesM                ______________________server__________________________________t  N                                                                Scripting  11-5 h  e            )                CGI Variable Demonstrationr  K                The basic CGI symbol names are demonstrated here with a callsG                to a script that simply executes the following DCL code:   %                   $ SHOW SYMBOL WWW_* !                   $ SHOW SYMBOL *i  K                Note how the request components are represented for ISINDEX-hK                style searching (third item) and a forms-based query (fourthd                item).e  /                <online hypertext demonstration>m  #                CGI Compliant Output   K                Script output must behave in a CGI-compliant fashion (by way H                of contrast, see Section 11.4). That is, a CGI script mayG                redirect the location of the document, using a Location:nH                header line, or may supply a data stream beginning with aJ                Content-Type: header line. Both must be followed by a blank                line.  M                If the script output begins with either of the these two linessL                HTTPd assumes that output will be line-oriented, without HTTPJ                carriage-control (each line terminated by a carriage-returnH                then a line-feed), and will thereafter ensure each recordK                it receives is correctly terminated before passing it to the K                client. In this way DCL procedure output (and the VMS CLI in 3                general) is supported transparently.a  &             11.3.1 Example DCL Scripts  C                A simple script to provide the system time might be:r  ,                   $ say = "write sys$output"=                   $! the next two lines make it CGI-compliant 2                   $ say "Content-Type: text/plain"                   $ say ""6                   $! start of plain-text script output                   $ show timem  J                A script to provide the system time more elaborately (using                HTML):                          11-6  Scripting  d  t            ,                   $ say = "write sys$output"=                   $! the next two lines make it CGI-compliants1                   $ say "Content-Type: text/html"                    $ say ""0                   $! start of HTML script output                    $ say "<HTML>"C                   $ say "Hello ''WWW_REMOTE_HOST'"  !(CGI variable)                    $ say "<P>"rI                   $ say "System time on node ''f$getsyi("nodename")' is:"e0                   $ say "<H1>''f$cvtime()'</H1>"!                   $ say "</HTML>"i    *             11.4 Non-CGI Compliance Output  L                A script does not have to output a CGI-compliant data stream.J                If it begins with a HTTP header status line (e.g. "HTTP/1.0M                200 OK"), HTTPd assumes it will supply a raw HTTP data stream,a4                containing all the HTTP requirements.  L                Any such script must observe the HyperText Transfer Protocol.K                Every line must be terminated by a carriage-return and line-aJ                feed (represented as "\r""\n"), or as a minimum by a singleL                line-feed. In particular, the type of the data being returnedK                by the scripts must be included in an HTTP header sent priorrM                to the data itself. Headers for the two most common data typesnM                will be illustrated here. Note that the blank line is strictlyu3                necessary, it terminates the header.                   Plain-Textt  %                   HTTP/1.0 200 ok\r\n .                   Content-Type: text/plain\r\n                   \r\n                  HTML   %                   HTTP/1.0 200 ok\r\nc-                   Content-Type: text/html\r\n_                   \r\n  +                Non-CGI-Compliant DCL scriptn  H                The following example show a non-CGI-compliant DCL scriptK                similar in function to the CGI-compliant one above. Note the J                full HTTP header and each line explicitly terminated with a2                carriage-return and line-feed pair.      N                                                                Scripting  11-7 P  n            "                   $ cr[0,8] = %x0d"                   $ lf[0,8] = %x0a,                   $ say = "write sys$output"=                   $! the next line makes it non-CGI-compliantt>                   $ say "HTTP/1.0 200 Time follows.''cr'''lf'";                   $ say "Content-Type: text/html''cr'''lf'"f$                   $ say "''cr'''lf'"0                   $! start of HTML script output*                   $ say "<HTML>''cr'''lf'"M                   $ say "Hello ''WWW_REMOTE_HOST'''cr'''lf'"  !(CGI variable)                    $ say "<P>" S                   $ say "System time on node ''f$getsyi("nodename")' is:''cr'''lf'" :                   $ say "<H1>''f$cvtime()'</H1>''cr'''lf'"+                   $ say "</HTML>''cr'''lf'"                  11.5 Raw HTTP InputR  G                The logical name SYS$INPUT (with a synonym of HTTP$INPUT H                for backward compatibility), <stdin> for C Language basedK                scripts, defines a mailbox providing a stream containing thesJ                request body (if any). This is available for procedures and7                executables to explicitly open and read.y  H                Note that this is a raw stream, and HTTP lines (carriage-L                return/line-feed terminated sequences of characters) may haveM                be blocked together for network transport. These would need ton2                be explicity parsed by the program.  J                NOTE: Versions of the server prior to 4.3 supplied the fullK                request (header then body) to the script. This was not fully H                CGI-compliant. Versions 4.3 and following supply only theF                body, although the previous behaviour may be explicitlyK                selected using the configuration parameter [DclFullRequest].   "             11.6 CGIplus Scripting  L                Common Gateway Interface ... plus lower latency, plus greater7                efficiency, plus far less system impact!e  K                I know, I know! The term CGIplus is a bit too_cute but I hadv$                to call it something!  I                CGIplus attempts to eliminate the overhead associated with H                creating the subprocess and then executing the image of aJ                CGI script. It does this by allowing the subprocess and anyI                associated image/application to continue executing betweencI                uses, eliminating any startup overheads. This reduces bothTF                the load on the system and the request latency. In thisJ                sense these advantages parallel those offered by commercialG                HTTP server-integration APIs, such as Netscape NSAPI andlM                Microsoft ISAPI, without the disadvantages of such proprietoryb               11-8  Scriptinge l               M                interfaces, the API complexity, language dependency and serverh#                process integration.   L                CGIplus is not as complex (and consequently nor as versatile)E                as another approach to improving CGI performance, Open J                Market's FastCGI, see http://www.fastcgi.com/ (which, whileK                having laudable platform-independence, strikes the author as 1                being "CGI" in nomenclature only).g  H                CGIplus design is generic enough to be easily implementedE                by other server architectures if found desirable. (ForsI                example, it is imagined Unix platforms would implement the K                CGIplus variable stream using named pipes one of which wouldnH                be designated by the CGIPLUSIN environment variable.) TheL                CGIplus-specific script environment and example code has beenL                made as platform-neutral as possible, providing potential forL                a more wide-spread adoption. Existing CGI scripts can rapidlyI                and elegantly be modified to additionally support CGIplus.mL                The capability of scripts to easily differentiate between andK                operate in both standard CGI and CGIplus environments with a2A                minimum of code revision offers great versatility.f  "                CGIplus Performance  I                A simple performance evaluation indicates the advantage ofsH                CGIplus. See Section 12.2 for some test results comparingI                the non-persistant-process, persistant-process and CGIplus                 environments.  K                Without a doubt, the subjective difference in activating thegK                same script within the standard CGI and CGIplus environments "                is quite startling!  "                CGIplus Programming  L                The script interface is still CGI, which means a new API doesL                not need to be learned and existing CGI scripts are simple to                modify.  4                See examples in HT_ROOT:[SRC.CGIPLUS]  '                <on-line hypertext link>c  E                Instead of having the CGI variables available from the4J                environment (generally accessed via the C Language getenv()H                standard library call) a CGIplus script must read the CGII                variables from CGIPLUSIN. They are supplied as a series ofZH                records (lines) containing a CGI variable name (in upper-G                case), an equate symbol and then the variable value. ThesL                line will never contain more than 1024 characters. The formatH                may be easily parsed and as the value contains no encoded/                characters may be directly used.o  N                                                                Scripting  11-9 i  e            '                Requirements when using:a  L                o  The read will block between subsequent requests and so may8                   be used to coordinate the application.  D                o  The first record read in any request can always beE                   discarded. This is provided so that a script may be K                   synchronized outside of the general CGIplus variable read D                   loop (the DCL and Perl examples use this feature).  G                o  The CGIplus variable stream should be completely read K                   (up until the blank line, see below) before beginning any %                   request processing.e  I                o  The CGIplus variable stream should ALWAYS BE COMPLETELYs<                   READ (up until the blank line, see below).  L                o  An empty record (blank line) indicates the end of a singleK                   request's CGIplus variable stream. Reading MUST be halted F                   at this stage. Request processing may then commence.  M                After processing, the CGIplus script can loop, waiting to readt>                the details of the next request from CGIPLUSIN.  F                Request output (to the client) is written to SYS$OUTPUTI                (<stdout>) as per normal CGI behaviour. End of output MUST I                be indicated by writing a special EOF record to the output J                stream. This is bit of a kludge, and the least elegant partM                of CGIplus design, but it is also the simplest implementation. K                A unique EOF sequence is generated for each use of DCL via a K                zombie or CGIplus subprocess. A non-repeating series of bits L                most unlikely to occur in normal output is employed . . . butJ                there is still a very, very, very small chance of prematureD                termination of output (one in 2^280 I think!) See HT_D                ROOT:[SRC.HTTPD]DCL.C for how the value is generated.  H                The CGIplus EOF string is obtained by the script from theI                logical name CGIPLUSEOF, defined in the script subprocess'pG                process table, using the scripting language's equivalent I                of F$TRNLNM(),  SYS$TRNLNM(), or a getenv() call (in the C K                standard library). This string will always contain less than L                64 characters and comprise only printable characters. It mustH                be written at the conclusion of a request's output to theK                output stream as a single record (line) but may also contain J                a <CR><LF> or just <LF> trailing carriage-control (to allowH                for programming language requirements). It only has to beK                evaluated once, as the processing begins, remaining the same J                for all requests over the life-time of that instance of the                script.  L                HTTP input (raw request stream, header and any body) is still-                available to a CGIplus script.f               11-10  Scripting                                 Code Examples  H                Of course a CGIplus script should only have a single exitF                point and should explicitly close files, free allocatedI                memory, etc., after processing a request (i.e. not rely onyK                image run-down to clean-up after itself). It is particularlyEG                important when modifying existing scripts to work in the I                CGIplus environment to ensure this requirement is met (whoyH                of us hasn't thought "well, this file will close when the$                image exits anyway"?)  D                It is a simple task to design a script to modify it'sI                behaviour according to the environment it is executing in. J                Detecting the presence or absence of the CGIPLUSEOF logicalL                is sufficient indication. The following C code fragment showsM                simultaneously determining whether it is a standard or CGIplus_L                environment (and setting an appropriate boolean), and getting7                the CGIplus EOF sequence (if it exists).   !                   int  IsCgiPlus;y'                   char  *CgiPlusEofPtr;   O                   IsCgiPlus = ((CgiPlusEofPtr = getenv("CGIPLUSEOF")) != NULL);   J                The following C code fragment shows a basic CGIplus requestL                loop, reading lines from CGIPLUSIN, and some basic processingG                to select required CGI variables for request processing.T                      if (IsCgiPlus)                   { !                      char  *cptr; '                      char  Line [1024], ,                            RemoteHost [128];&                      FILE  *CgiPlusIn;  P                      if ((CgiPlusIn = fopen (getenv("CGIPLUSIN"), "r")) == NULL)                      {2                         perror ("CGIplus: fopen");!                         exit (0);e                      }                    N                                                               Scripting  11-11                                       for (;;)                       {H                         /* will block waiting for subsequent requests */                          for (;;)                         {MS                            /* should never have a problem reading CGIPLUSIN, but */ M                            if (fgets (Line, sizeof(Line), CgiPlusIn) == NULL)                             {8                               perror ("CGIplus: fgets");'                               exit (0);                             }V                            /* first empty line signals the end of CGIplus variables */6                            if (Line[0] == '\n') break;<                            /* remove the trailing newline */Q                            if ((cptr = strchr(Line, '\n')) != NULL) *cptr = '\0';r  Q                            /* process the CGI variable(s) we are interested in */ G                            if (!strncmp (Line, "WWW_REMOTE_HOST=", 16))f;                               strcpy (RemoteHost, Line+16);s                         }_  ?                         (process request, signal end-of-output)                       }                   }   G                CGI scripts can write output in record (line-by-line) orIH                binary mode (more efficient because of buffering by the CJ                RTL). When in binary mode the output stream must be flushedL                immediately before and after writing the CGIplus EOF sequenceJ                (note that in binary a full HTTP stream must also be used).K                This code fragment shows placing a script output stream intoe2                binary mode and the flushing steps.  W                   /* reopen output stream so that the '\r' and '\n' are not filtered */GX                   if ((stdout = freopen ("SYS$OUTPUT", "w", stdout, "ctx=bin")) == NULL)'                      exit (vaxc$errno);                      do {  '                      (read request ...)i  /                      /* HTTP response header */ \                      fprintf (stdout, "HTTP/1.0 200 ok\r\nContent-Type: text/html\r\n\r\n");  '                      (other output ...)i  #                      if (IsCgiPlus)                       {O                         /* the CGIplus EOF must be an independant I/O record */t(                         fflush (stdout);>                         fprintf (stdout, "%s", CgiPlusEofPtr);(                         fflush (stdout);                      }               11-12  Scripting                 &                   } while (IsCgiPlus);  J                If the script output is not binary (using default <stdout>)J                it is only necessary to ensure the EOF string has a record-#                delimiting new-line.   :                   fprintf (stdout, "%s\n", CgiPlusEofPtr);  F                Other languages may not have this same requirement. DCLM                procedures are quite capable of being used as CGIplus scripts.i  4                See examples in HT_ROOT:[SRC.CGIPLUS]  '                <on-line hypertext link>e  G                Whenever developing CGIplus scripts/applications (unlike M                standard CGI) don't forget that after compiling, the old imageoJ                must be purged from the server before trying out the new!!!6                (I've been caught a number of times :^)  I                Scripting subprocesses may be purged or deleted using (see                  Section 5.3.2.3):  (                   $ HTTPD /DO=DCL=DELETE'                   $ HTTPD /DO=DCL=PURGE   #                Other Considerations   H                Multiple CGIplus scripts may be executing in subprocessesG                at any one time. This includes multiple instances of any4I                particular script. It is the server's task to track these,uF                distributing appropriate requests to idle subprocesses,G                monitoring those currently processing requests, creatingsK                new instances if and when necessary, and deleting the least-TK                used, idle CGIplus subprocesses when configurable thresholds H                are reached. Of course it is the script's job to maintainE                coherency if multiple instances may result in resourceoG                conflicts or race conditions, etc., between the scripts.t  I                The CGIplus subprocess can be given a finite life-time setdL                by configuration parameter (see Chapter 6). If this life-timeJ                is not set then the CGIplus will persist indefinitely (i.e.K                until purged due to soft-limits being reached, or explicitly I                purged/deleted). When a life-time has been set the CGIplus0K                subprocess is automatically deleted after being idle for therK                specified period (i.e. not having processed a request). This I                can be useful in preventing sporadically used scripts from 5                cluttering up the system indefinitely.e  K                In addition, an idle CGIplus script can be terminated by theiK                server at any time the subprocess soft-limit is reached (thePI                subprocess SYS$DELPRC()ed)  so resources should be largely-J                quiescent when not actually processing. Of course a CGIplus  N                                                               Scripting  11-13    x            L                subprocesses may also be manually terminated from the command$                line (e.g. STOP/ID=).  M                Some CGIplus scripting information and management is availablefD                via the server administration menu, see Section 10.1.  #                CGIplus Rule Mapping   K                CGIplus scripts are differentiated from standard CGI scripts'M                in the mapping rule configuration file using the "script+" andi1                "exec+" directives. See Chapter 8.   L                Scripts capable of operating in both standard CGI and CGIplusK                environments may simply be accessed in either via rules such                 as   ,                   exec /cgi-bin/* /cgi-bin/*1                   exec+ /cgiplus-bin/* /cgi-bin/*   G                while specific scripts can be individually designated asa                CGIplus using  E                   script+ /cgiplus_example* /cgi-bin/cgiplus_example*   I                Caution!  If changing CGIplus script mapping it is advised J                to restart the server rather than reloading the rules. SomeG                conflict is possible when using new rules while existinge-                CGIplus scripts are executing.   .             11.7 HTTP Persistant-State Cookies  L                The server is cookie-aware. That is, if the client supplies aL                "Cookie:" request header line it is passed to a CGI script asM                "WWW_HTTP_COOKIE" CGI variable symbol. If a cookie is not part J                of the request this symbol does not exist. A script may useE                the "Set-Cookie:" response header line to set cookies.   M                Here is a small demonstration of cookie processing using a DCL                 script.  /                <online hypertext demonstration>.                               11-14  Scripting e  c                M             Chapter__12______________________________________________________t               Server Performance    L                The server has a single-process, multi-threaded, asynchronousH                I/O design. On a single-processor system this is the mostL                efficient approach. On a multi-processor system it is limitedL                by the single process context (ignoring scripts which executeF                within their own context). An obvious improvement wouldG                be to have multi-processor threading or a pool of serversI                processes, one per CPU, servicing requests. The latter mayfH                be the approach of future refinements. No content-cachingK                is performed by the server. All file transfer requires file-                 system access.   M                The server has been tested with up to 30 simultaneous requestslL                originating from 6 different systems and continues to provideL                an even distribution of data flow to each client (albeit more                slowly :^).  L                Test results are all obtained using the native Digital TCP/IPE                Services executable. The NETLIB image may provide veryeI                slightly lower results due to the additional NETLIB layer.i1                These results are indicative only!s  .                Simple File Request Turn-Around  L                A series of tests using batches of 200 accesses were made andJ                the results averaged. The first test returned an empty fileH                measuring response and file access time (this server doesK                not cache), without transfer time. The second test requested H                files of 16K and 64K characters, testing performance withJ                more realistic scenarios. Both were done using one and thenJ                ten simultaneous requests. No Keep-Alive: functionality wasM                employed so each request required a complete TCP/IP connection M                and disposal, although the WWWRKOUT utility (see Section 14.5) K                was used on the same system as the HTTPd server, eliminating L                actual network transport. DNS (name resolution) was disabled.I                The test system was a lightly-loaded AlphaServer 2100, VMStI                v6.2 and DEC TCP/IP 4.1. The command-lines are show below:t  a                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/ht_root/exercise/0k.txt" b                   $ WWWRKOUT /SIM=10 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/ht_root/exercise/0k.txt"b                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/ht_root/exercise/16k.txt"c                   $ WWWRKOUT /SIM=10 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/ht_root/exercise/16k.txt"lb                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/ht_root/exercise/64k.txt"c                   $ WWWRKOUT /SIM=10 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/ht_root/exercise/64k.txt"   N                                                       Server Performance  12-1 s  a            L                These results were derived using the v4.4 server. SignificantF                improvements in throughput over the 4.2/4.3 servers areG                due to optimizations in frequently executed code and theiG                elimination of debug code in production executables. (An L                apparent improvement in throughput for multiple, simultaneousI                connections over the 4.2/4.3 server is due to the redesignoG                of the testing tool, WWWRKOUT, which improved its multi-c                threading!)  M                ______________________________________________________________ 7                                                duration M                Response_________simultaneous___(seconds)______requests/second   A                0K               1              1.23           162t  A                0K               10             0.95           210r  A                16K              1              1.24           161o  A                16K              10             0.95           210   A                64K              1              1.31           153e  M                64K______________10_____________0.96___________208____________h  L                Significantly, throughput actually improved at ten simultane-M                ous requests (probably due to the latency of the serial TCP/IP J                connection/disconnection in one-by-one, compared to several<                happening concurrently for ten simultaneous).  0                Simple File Request Transfer Rate  D                The simple text file request under similar conditionsK                indicates a potential transfer rate in excess of 1 Mbyte perhH                second. (Remember, both client and server are on the sameH                system, so the data, although being transported by TCP/IPF                networking, is not actually ending up out on a physicalL                network.) This serves to demonstrate that server architectureD                should not be the limiting factor in file throughput.  _                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=10 "/ht_root/log/access.log" `                   $ WWWRKOUT /SIM=10 /NOBREAK /NOVARY /NOOUT /COUNT=10 "/ht_root/log/access.log"^                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=10 "/ht_root/log/total.log"_                   $ WWWRKOUT /SIM=10 /NOBREAK /NOVARY /NOOUT /COUNT=10 "/ht_root/log/total.log"l  @                These results were derived using the v4.2 server.        $             12-2  Server Performance n                 M                ______________________________________________________________e9                                                  durationoM                Response______________simultaneous(seconds)___Kbytes/second___   B                2M (4123 blocks)      1           8           2,570  B                2M (4123 blocks)      10          16          1,336  B                7M (14852 blocks)     1           59          1,278  M                7M_(14852_blocks)_____10__________62__________1,224___________m  K                Significantly, there were no dramatic drops in transfer ratel9                between one and ten simultaneous requests!t  #             12.1 File Record Formata  H                The server can handle STREAM, STREAM_LF, STREAM_CR, FIXEDK                and UNDEFINED record formats very much more efficiently thanh%                VARIABLE or VFC files.,  G                With STREAM, FIXED and UNDEFINED files the assumption iseI                that HTTP carriage-control is within the file itself (i.e. J                at least the newline (LF), all that is required required byJ                browsers), and does not require additional processing. WithH                VARIABLE record files the carriage-control is implied andJ                therefore each record requires additional processing by theJ                server to supply it. Even with variable record files havingI                multiple records buffered by the HTTPd before writing themnK                collectively to the network improving efficiency, stream andtH                binary file reads are by Virtual Block and are written toH                the network immediately making the transfer of these very                 efficient indeed!  L                So significant is this efficiency improvement a module existsJ                to automatically convert VARIABLE record files to STREAM-LFM                when detected by the file transfer module. This is disabled byeK                default but the user is strongly encouraged to enable it andcL                to ensure that stream format files are provided to the serverG                by other hypertext generating and processing utilitites.(               12.2 Scripting  L                Persistant-subprocesses are probably the most efficient solu-L                tion for child-process scripting under VMS. See Section 11.2.G                The I/O still needs to be on-served to the client by the=                server.    N                                                       Server Performance  12-3 a  g            H                A simple performance evaluation shows the relative meritsI                of the three scripting environments available. Two results G                are provided here. Both were obtained using the WWWRKOUT M                utility (see Section 14.5) accessing the same CGI test utility I                script, HT_ROOT:[SRC.CGIPLUS]CGIPLUSTEST.C, which executes I                in both standard CGI and CGIplus environments. A series of G                200 access were made and the results averaged. The first I                test returned only the HTTP header, evaluating raw request H                turn-around time. The second test requested a body of 16KJ                characters, again testing performance with a more realisticJ                scenario. No Keep-Alive: functionality was employed so eachJ                request required a complete TCP/IP connection and disposal,H                although the WWWRKOUT utility was used on the same systemI                as the HTTPd server, eliminating actual network transport. M                DNSLookup (host name resolution) was disabled. The test system M                was a lightly-loaded AlphaServer 2100, VMS v6.2 and DEC TCP/IP H                4.1. (An apparent improvement in throughput for multiple,I                simultaneous connections over the 4.2/4.3 server is due toeM                the redesign of the testing tool, WWWRKOUT, which improved itseB                multi-threading!) The command-lines are show below:  _                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/cgi-bin/cgiplustest?0""a                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/cgi-bin/cgiplustest?200" c                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/cgiplus-bin/cgiplustest?0" e                   $ WWWRKOUT /SIM=1 /NOBREAK /NOVARY /NOOUT /COUNT=200 "/cgiplus-bin/cgiplustest?200"   @                These results were derived using the v4.4 server.  M                ______________________________________________________________ 7                                      CGI (non-      CGIGM                Response______________persistant)____(persistant)___CGIplus___   F                0K duration           28.2           16.6           5.5                (seconds)  G                0K requests/second    7.1            12.0           36.0   F                16K duration          29.3           17.7           6.7                (seconds)  M                16K_requests/second___6.8____________11.2___________29.7______x  F                A similar run of tests using ten simultaneous requests.  M                ______________________________________________________________f7                                      CGI (non-      CGImM                Response______________persistant)____(persistant)___CGIplus___   F                0K duration           20.7           10.5           4.7                (seconds)  $             12-4  Server Performance               M                ______________________________________________________________ 7                                      CGI (non-      CGI M                Response______________persistant)____(persistant)___CGIplus___I  G                0K requests/second    9.7            19.1           43.0u  F                16K duration          27.8           15.6           8.9                (seconds)  M                16K_requests/second___7.2____________12.9___________22.6______o  G                Again significantly, throughput actually improved at ten.H                simultaneous requests (probably due to the latency of theM                serial TCP/IP connection/disconnection in one-by-one, compared G                to several happening concurrently for ten simultaneous).lF                Slight reductions in throughput over the 4.2/4.3 serverI                scripting is probably due to some additional CGI variablesm,                being supplied to the script.  G                Although these results are indicative only, they do showiL                CGIplus to have a potential for improvement over standard CGIL                in the order of 250-300% (when using persistant-subprocesses,H                or zombies, 400-600% over non-persistant subprocesses), aI                not inconsiderable increase. Of course this test generatesaL                the output stream very simply and efficiently and so excludesJ                any actual processing time that may be required by a "real"L                application. If the script/application has a large activationH                time the reduction in response latency could be even moreI                significant (e.g. Perl scripts and RDBS access languages).l               12.3 Suggestions  M                Here are some suggestions for improving the performance of thebM                server, listed in approximate order of significance. Note thatuI                these will have proportionally less impact on an otherwises%                heavily loaded system.c  I                1. Ensure served files are not VARIABLE record format (seeaK                   above). Enable STREAM-LF conversion using a value such asC;                   250 (configuration parameter [StreamLF]).p  H                2. Use persistant-subprocess DCL/scripting (configuration-                   parameter [ZombieLifeTime])G  @                3. Use CGIplus-capable scripts whenever possible.  G                4. Disable host name resolution (configuration parameterdL                   [DNSLookup]). This can slow processing significantly. MostI                   log analysis tools can convert numeric addresses so DNS <                   resolution is often an unnecessary burden.  N                                                       Server Performance  12-5 d  h            J                   This can actually make a remarkable difference. The sameJ                   test provided very different throughputs with DNS lookup'                   enabled and disabled.   N                   ____________________________________________________________+                                    durationdN                   _________________(seconds)________requests/second___________  6                   DNSLookup ON     7.7              26  N                   DNSLookup_OFF____2.6______________77________________________  F                5. Disable logging (configuration parameter [Logging]).  M                6. Set the HTTPd server process priority higher, say to 6 (use 0                   startup qualifier /PRIORITY=).  K                7. Reduce to as few as possible the number of mapping rules.d  H                8. Place more-commonly resolved content-types towards theH                   top of the configuration list (configuration parameter                   [AddType]).   L                9. Use a pre-defined log format (e.g. "common", configuration)                   parameter [LogFormat]).   G               10. Disable request history (configuration parameter [Re-l!                   questHistory]).i  F               11. Disable activity statistics (configuration parameter"                   [ActivityDays]).                                      $             12-6  Server Performance w  e                M             Chapter__13______________________________________________________S               HTTPd Web Update    M                The Update facility allows Web documents and file environmentseJ                to be administered from a standard browser. This capabilityM                is available to Web administrator and user alike. AvailabilityhM                and capability depends on the authorization environment within-                the server.  H                It should be stressed that this is not designed as a fullK                hypertext administration or authoring tool, and for documentpD                preparation relies on the editing capabilities of theH                <TEXTAREA> widget of the user's browser. It does however,M                allow ad-hoc changes to be made to documents fairly easily, as K                well as allowing documents to be deleted, and directories to &                be created and deleted.  I                Consult the current Update documentation for usage detail.o  &                <online hypertext link>  '                Update Access Permissions  G                Of course, the user must have write (POST/PUT) access toeI                the document or area on the server (i.e. the path) and thefK                server account have file system permission to write into thee                 parent_directory.  G                The server will report "Insufficient privilege or object K                protection violation ... /path/document" if it does not haves@                file system permission to write into a directory.  L                The following shows an example of setting an ACL to allow theK                HTTPd server acount to write into a directory. This does notiD                propagate into any subdirectories created beneath it:  0                   $ SET SECURITY directory.DIR ->                     /ACL=(IDENT=HTTP$SERVER,ACCESS=READ+WRITE)  G                This example shows setting an ACL that will propagate toL&                created subdirectories:  0                   $ SET SECURITY directory.DIR -Y                     /ACL=((IDENT=HTTP$SERVER,OPTIONS=DEFAULT,ACCESS=READ+WRITE+DELETE), - G                           (IDENT=HTTP$SERVER,ACCESS=READ+WRITE+DELETE))   M                Also see Controlling Server Write Access for other informationo6                on write access control for the server.  N                                                         HTTPd Web Update  13-1 f  a                M             Chapter__14______________________________________________________                Utilitiesu    M                Foreign commands for external utilities (and the HTTPD controluK                functionality) will need to be assigned in the adminstration E                users' LOGIN.COM. Alternatives should be used when themA                environment supported through NETLIB. For example:e  *                   HTTPD == "$HT_EXE:HTTPD"2                   !HTTPD == "$HT_EXE:HTTPD_NETLIB"0                   HTTPDMON == "$HT_EXE:HTTPDMON"0                   STREAMLF == "$HT_EXE:STREAMLF"0                   WWWRKOUT == "$HT_EXE:WWWRKOUT"8                   !WWWRKOUT == "$HT_EXE:WWWRKOUT_NETLIB"               14.1 Echo Facility  J                Ever had to go to extraordinary lengths to find out exactlyE                what your browser is sending to the client? The servereH                provides a request echo facility. This merely returns theJ                complete request as a plain-text document. This can be usedJ                for for checking the request header lines being provided byJ                the browser, and can be valuable in the diagnosis of POSTed                forms, etc.  J                This facility must be enabled through a mapping rule entry.  $                   pass /echo* /echo*  G                It may then be used with any request merely by insertingeM                "/echo" at the start of the path, as in the following example.a  ?                   http://wasd.dsto.defence.gov.au/echo/ht_root/i               14.2 Xray Facility  L                The Xray facility returns a request's complete response, bothK                header and body, as a plain text document. Being able to seeeK                the internals of the response header as well as the contentsmL                of the body rendered in plain text can often be valuable when'                developing scripts, etc.   J                This facility must be enabled through a mapping rule entry.  $                   pass /Xray* /Xray*  N                                                                Utilities  14-1 t               G                It may then be used with any request merely by inserting1M                "/xray" at the start of the path, as in the following example.   ?                   http://wasd.dsto.defence.gov.au/xray/ht_root/   !             14.3 StreamLF Utility   G                This utility converts VARIABLE and VAR_? format files to_I                STREAM_LF. The WASD HTTPd server access STREAM_LF files in G                block/IO-mode, far more efficiently that the record-modeoJ                required by variable-record format files. Use STREAMLF/HELP0                for some basic usage information.  H                NOTE  This server can also be configured to automaticallyH                convert any VARIABLE record format files it encounters to                STREAM_LF.c               14.4 HTTPd Monitor  L                The HTTPd server may be monitored using the HTTPDMON utility.I                This utility continuously displays a screen of informationo)                comprising three sections:i  %                1. Process InformationlJ                   HTTPd process information includes its up-time, CPU-timeH                   consumed (excluding any subprocesses), I/O counts, and%                   memory utilization.N  !                2. Server CountersrI                   The server counters keep track of the total connections M                   received, accepted, rejected, etc., totals for each request H                   type (file transfer, directory listing, image mapping,                   etc.).                   3. Latest RequestK                   This section provides the originating host, HTTP request,4H                   response status code, and some transaction statistics.  <                The following example provides sample output:  _                  Port: 8088    HTTPDMON v1.2.0 AXP (HTTPd v4.2)    Friday, 20-JUN-1997 07:40:45s  G                  Process: HTTPd:8088  PID: 2048F4CC  User:  HTTP$SERVER :                  Startup: 0  Exit Status: n/a  (Zeroed: 0);                       Up: 0 14:37:14.93  CPU: 0 05:00:02.073Z                  Pg.Flts: 2116  Pg.Used: 26%  WsSize: 6768 (3384kB)  WsPeak: 4960 (2480kB)V                      AST:   15/600   BIO:    2/512   BYT:      0/135840  DIO:    0/512V                      ENQ:    0/600   FIL:    6/100   PRC:      8/50       TQ:   16/200                 14-2  Utilities                  Z                  Connect: 328729  Accept: 328729  Reject: 0  Busy: 0  Current: 0  Peak: 17M                    Error: 0  Parse: 328733 (2 redirect)  Forbidden: 0  RMS: 0 B                   DELETE: 0  GET: 328733  HEAD: 0  POST: 0  PUT: 0I                    Admin: 6  Directory: 41090  File: 143816 (1)  IsMap: 2g:                     Menu: 0  Put: 0  SSI: 20544  Update: 1[                      DCL: 184896  CGI: 82182  CGIplus: 41090 (41090)  Spawn: 41  Subproc: 8s  P                      1xx: 0  2xx: 308186  3xx: 1  4xx: 20544  5xx: 0  (0 errors)@                       Rx: 27,947,098  Tx: 2,453,232,050  (bytes)  C                     Time: 20 07:33:04  Host: datlv.wasd.dsto.gov.aul0                   Status: 200  Rx: 95  Tx: 34474>                  Request: GET /ht_root/exercise/escherknot.gif  1                                              Notep  A                      Yes! This is a genuine screen capture duringbB                      an extended testing period using the WWWRKOUTB                      utility (see Section 14.5) from two other VMSH                      systems in the same cluster. One third of a millionF                      requests, and nearly of 2.5 Gigabytes transmittedF                      in approximately 14 hours of testing on a heavilyG                      loaded, general-purpose system! Requests comprised @                      a mixture of file transfers, SSI documents,E                      directory listings and CGI applications. This istG                      an average of 6.5 requests per second and transfer -                      of 50 Kbytes per second.o  B                The /HELP qualifier provides a brief usage summary.  H                This information is, in part, obtained from the following                logical names:   "                o  HTTPDport$COUNT1  "                o  HTTPDport$COUNT2                  o  HTTPDport$PID3  #                o  HTTPDport$REQUESTs  G                The server counter values are carried over when a serverhG                (re)starts (provided the system has stayed up). To reseteK                the counters use the on-line server administration menu (seey                Chapter 10).   -             14.5 Server Workout (stress-test),  K                The WWWRKOUT ("World Wide Web Workout") utility exercises anaJ                HTTP server, both in the number of simultaneous connectionsF                maintained and in the number of back-to-back sequentialI                connection requests and data transfers. A native UCX imageu8                and a separate NETLIB image are provided.  N                                                                Utilities  14-3 e  i            H                This utility can be used to stress-test the WASD VMS HTTPG                server (or any other), or to make comparisons between itWJ                and other servers. When stress-testing a server, evaluatingG                performance or just using it to try and break a test-bedtH                server, it is best used from multiple, autonomous systems                simultaneously.  J                It sets up and maintains a specified number of simultaneousK                connections to a server. It reads a buffer of data from eachsJ                connection in turn, where data is waiting (does not block),I                until the document transfer is complete and the connectioneE                closed by the server. It then closes the local end andOI                immediately reuses the now-free socket to initiate another=L                sequence. If enabled (it is by default), the utility attemptsJ                to reflect the real-world in varying the data transfer rateG                for each connection, by setting the number of bytes read I                during each read loop differently for each connection. Allw,                transfered data is discarded.  F                The data transfer rate for each connection is displayedH                at connection close. It is by default it is the effectiveJ                transfer rate, that is the rate from opening the connectionK                to closing it, and so includes request processing time, etc.eH                If the /NOEFFECTIVE qualifier is employed it measures the0                document data transfer rate only.  F                Although a single document path may be specified on theJ                command line it is preferable to supply a range of documentK                paths, one per line in a plain text file. Each document path J                and/or type specified should be different to the others, toM                exercise the server and file system cache. Any number of paths_L                may be specified in the file. If the file is exhausted beforeL                the specified number of connections have been established theK                file contents are recycled from the first path. If a path or_L                a file of paths is not specified the utility just continually-                requests the welcome document.   K                To assess a server's total throughput choose paths that lead K                to large documents (> 50K), where the overhead of connection F                setup, rule processing and transfer initiation are lessI                significant than the data transfer itself. The buffer size_K                variation functionality should be disabled using the /NOVARY K                qualifier when assessing data transfer rates. ResponsivenessaE                is better assessed using small documents (< 2K), whereoG                the overhead of the non-data-transfer activities is morer                significant.   E                WWWRKOUT [server_host_name[:port]] [path] [qualifiers]   J                o  /[NO]BREAK will randomly break a small number of connec-M                   tions during the data transfer (tests server recovery undern&                   those circumstances)               14-4  Utilitiesl r  p            K                o  /BUFFER= number of bytes to be read from server each timetI                   (default is 1024, will be modified by the default /VARYp                   qualifier)  M                o  /COUNT= total number of connections and requests to be donet"                   (default is 100)  I                o  /[NO]EFFECTIVE measures data transfer rate from requestuK                   to close (if /NOEFFECTIVE is applied the rate is measured +                   during data transfer onlyu  B                o  /FILEOF= file name containing paths to documents  7                o  /HELP display brief usage information   /                o  /OUTPUT= file name for outputo  @                o  /PATH= single path to document to be retrieved  F                o  /PORT= IP port number of HTTP server (default is 80)  0                o  /SERVER= HTTP server host name  M                o  /SIMULTANEOUS= number of simultaneous connections to be sete4                   up at any one time (default is 10)  G                o  /[NO]VARY varies the size of the read buffer for each .                   connection (default is vary)                  Examples:                     $ WWWRKOUT=                   $ WWWRKOUT www.server.host "/web/home.html"iC                   $ WWWRKOUT www.server.host:8080 /FILEOF=PATHS.TXTrb                   $ WWWRKOUT /SERVER=www.server.host /PORT=8080 /NOBREAK /NOVARY /FILEOF=PATHS.TXTX                   $ WWWRKOUT www.server.host:8080 /FILEOF=PATHS.TXT /NOEFFECTIVE /NOVARY_                   $ WWWRKOUT www.server.host /FILEOF=PATHS.TXT /COUNT=500 /SIMUL=20 /BUFFER=512c  B                The /HELP qualifier provides a brief usage summary.                      N                                                                Utilities  14-5 f  n                M             Chapter__15______________________________________________________   ,             Brief Introduction to HTTPd Code    J                This section is designed to be only a broad overview of theH                basic functionality of the HTTPd server. It also does notL                cover the full suite of WASD VMS Hypertext Services software.  I                NOTE: Some code descriptions have become very brief in the7J                transition from version 3 to version 4 of the HTTPd, duringH                which some significant changes occured to data structuresK                and processing. Also I have not been rigorous in my revision=I                of the descriptions, so they may be misleading (though notrI                grossly). Apologies! I'll blame time constraints, but morerH                probably this is a rationalization of procrastination :^)  8                The source code should also be consulted.  &                <online hypertext link>               15.1 Multi-Threaded   H                The WASD HTTPd is written to exploit VMS operating systemK                characteristics allowing the straight-forward implementation F                of multi-threaded code. The server is written to be I/OJ                event driven. Asynchronous System Traps (ASTs), or softwareG                interrupts, at the conclusion of an I/O (or other) event_M                allow functions to be activated to post-process the event. TheaM                event traps are automatically queued on a FIFO basis, allowingnH                a series of events to be sequentially processed. When notL                responding to an event the process is quiescent, or otherwiseI                occupied, effectively interleaving I/O and processing, andr?                allowing a sophisticated client multi-threading.h  J                Multi-threaded code is inherently more complex than single-K                threaded code, and there are issues involved in the synchro-iI                nization of some activities in such an environment. Fortu-gH                nately VMS handles many of these issues internally. AfterM                connection acceptance, all of the processing done within HTTPdnJ                is at USER mode AST delivery level, and for all intents andH                purposes the processing done therein is atomic, implictly7                handling its own synchronization issues.   H                HTTPd is written to make longer duration activities, suchI                as the transfer of a file's contents, event-driven. Other,aE                shorter duration activites, such as accepting a clientn=                connection request, are handled synchronously.   N                                         Brief Introduction to HTTPd Code  15-1 r  j            H                It is worth noting that with asynchronous, and AST-drivenI                output, the data being written must be guaranteed to exist H                without modification for the duration of the write (untilH                completion AST delivery). This means data written must beK                static or in buffers that persist with the thread. Function- I                local (automatic) storage cannot be used. The HTTPd serverTL                allocates dynamic storage for general (e.g. output buffering)8                or specific (e.g. response headers) uses.                 15.2 Tasks  L                Each request can have one or more tasks executed sequentiallyJ                to fullfil the request. This occurs most obviously with theK                HTML pre-processor, but also, to a more limited extent, withlJ                directory listing and its read-me file inclusion. A task is.                more-or-less defined as one of:                  o  send file                   o  send menuf  #                o  directory listinge  $                o  SSI interpretation  3                o  DCL execution (script processing)   %                o  POST/PUT processingu  ,                o  Update facility processing  K                Each one of these modules executes relatively independently.uJ                Before commencing a task, a next-task pointer can be set toI                the function required to execute at the conclusion of that=K                task. At that conclusion, the next-task functionality checks H                for a specified task to start or continue. If it has beenL                specified control is passed to that next-task function via an                AST."  M                Some tasks have the possibility of being called multiple times K                during a request, others do not. An example of the former isoM                the send file task, which is used when <!-#includeing multipleuJ                files within an SSI document. An example of a task that canK                only possibly be called once is the interpretation of an SSIh)                document within a request.         2             15-2  Brief Introduction to HTTPd Code o  O            "             15.3 Memory Management  G                Per-Thread memory is managed in three distinct portions.   M                1. A fixed-size structure of dynamic memory is used to contain J                   the core request thread data. This is released at thread                   disposal.   M                2. A heap of dynamically allocated memory is maintained during21                   the life of a thread structure.r  L                   When a dynamic structure is required this heap is expandedM                   by calloc()ing memory, placing this in a double-linked listeJ                   structure, and returning a pointer to the usable portionI                   of the newly allocated memory. This list is released in,J                   one operation at thread disposal, by traversing the listJ                   and free()ing each individual chunk (making it easier toK                   avoid the memory leaks associated with making autononmous J                   allocations for each dynamic memory structure required).  H                3. Per-task data structures are allocated using the above                   heap./  K                   These structures are used to store task-specific data. If K                   a task is used multiple times within the one request (see J                   above) the previous allocated and now finished-with (butJ                   not deallocated) task structures can be reused, reducing                   overhead.l  !             15.4 Output BufferingE  J                To reduce the number of individual network writes, and thusE                provide significant improvements in efficiency, outputeE                generated from all modules except File.c and Dcl.c, isRI                buffered into larger packets before sending to the client.eJ                All modules, including File.c, work to implement a seamlessI                integration of output via this mechanism (best seen in theh                SSI.c module).   K                The AST-driven nature of the server means this functionalityiM                is moderately complex. A form of double buffering is employed,IL                allowing the buffer to overflow and be flushed to the networkL                asynchronously, without overwriting, losing or needing to re-K                request data. Two buffer spaces are employed. When one fillsrJ                it is written to the network and a pointer to the two areasH                exchanged, allowing the supplied (and overflowed) data toJ                be immediately buffered (without a synchronous wait for theM                network write to complete), and an immediate return to further J                AST-driven processing. The alternate buffer continues to beA                used until it fills, when the process is repeated.U  N                                         Brief Introduction to HTTPd Code  15-3 S  E            K                The possibility of an asynchronous write with every buffered L                output introduces complexity. Every buffered output call mustH                be used as if it is an asynchronous network write, an ASTJ                function address supplied with every call on the off-chanceL                (and eventuality) that an actual network write will occur. IfK                a network write does not occur (most of the time) the AST is K                explicitly declared for delivery. This need to supply an AST K                function with every buffered write, basically means only one B                buffered write may occur per AST-executed function.                 15.5 Rule-Mapping   F                A fundamental aspect of any HTTPd implementation is theF                rule mapping used to create a logical structure for theL                hypertext file system. The HTTPd mapping function is designedF                to be flexible enough that script programs can also useI                it. As a result it is text-file based, and opened and read0H                when mapping. This method of mapping provides a good dealG                of flexibility, coupled with acceptable performance. The K                function has received a high level of attention in an effortY                to optimize it.               15.6 Auto-Scriptinga  I                The WASD VMS HTTP server has the facility to automaticallyeJ                invoke a script to process a non-HTML document (file). ThisH                facility is based on detecting the MIME content data typeJ                (via the file's extension) and causing a transparent, localM                redirection, invoking the script as if it was specified in the!                 original request.  2             15.7 Internal Directives and "Scripts"  G                The HTTPd server detects certain paths and query strings C                as directives about its behaviour. Certain paths are K                interpreted as pseudo, or internal scripts, handled internalaF                to the server. Other directives are passed in the queryI                string component of the request, and as reserved sequences J                cannot occur in normal requests (an unlikely combination of-                characters has been selected).   !                o  /httpd/-/admin/ H                   Pseudo-script, accesses the server administration menu1                   functionality (see Chapter 10).p  "                o  /httpd/-/change/M                   Pseudo-script, accesses user authentication password change)$                   (see Section 9.6).  2             15-4  Brief Introduction to HTTPd Code e  b                            o  /echo/D                   Pseudo-script, returns the request as a plain-text                   document.n                  o  /tree/F                   Pseudo-script, accesses the directory tree facility.                  o  /upd/ <                   Pseudo-script, access the Update facility.                  o  /Xray/J                   Pseudo-script, returns the complete response as a plain-                    text document.                  o  ?httpd=indexD                   Controls aspects of the directory listing module's                   behaviour:  #                   o  &autoscript=nog                      o  &format=vms  #                   o  &layout=string                      o  &readme=nos  #                   o  &script=string                15.8 HTTPd Modules  L                The HTTPd server comprises several main modules, implementingK                the obvious functionality of the server, and other, smaller,                 support modules.e  *                o  ADMIN.C (Section 15.8.1)  )                o  AUTH.C (Section 15.8.2)a  *                o  BASIC.C (Section 15.8.3)  '                o  DCL.C (Section 15.8.4O  )                o  DESCR.C (Section 15.8.5r  +                o  DIGEST.C (Section 15.8.6)s  (                o  DIR.C (Section 15.8.7)  )                o  FILE.C (Section 15.8.8)h  ,                o  HTADMIN.C (Section 15.8.9)  +                o  HTTPD.C (Section 15.8.10)t  +                o  ISMAP.C (Section 15.8.11)   -                o  LOGGING.C (Section 15.8.12)l  *                o  MENU.C (Section 15.8.13)  N                                         Brief Introduction to HTTPd Code  15-5                 )                o  MSG.C (Section 15.8.14)c  )                o  NET.C (Section 15.8.15)h  )                o  PUT.C (Section 15.8.16)   -                o  REQUEST.C (Section 15.8.17)s  )                o  SSI.C (Section 15.8.18)F  +                o  STMLF.C (Section 15.8.19)   -                o  SUPPORT.C (Section 15.8.20)   )                o  UPD.C (Section 15.8.21)h  M                o  WASD.H The main header file containing all data structures,a.                   etc. <online hypertext link>               15.8.1 ADMIN.C  &                <online hypertext link>  !                INCOMPLETE AS YET!   J                This module provides the on-line server administration menuH                and functionality. Some administration pages are providedF                by the Upd.c module, "piggy-backed" into normal editing                dialogues.                15.8.2 AUTH.Ca  &                <online hypertext link>  !                INCOMPLETE AS YET!i  K                Sorry, its fairly complex module so I'll have to plead beingm                too busy!  C                HTAdmin.c module helps administer the authentication                 databases.t  L                The authorization module handles user authentication and pathL                method authorization for all requests received by the server.I                Authenticated username/password information is cached in asJ                balanced binary tree, improving performance compared to on-=                disk checking each time a request is received.r  L                HTTPd-specific authentication databases are binary files withM                fixed-length 512 bytes records. Within the record is provision                 for:r                  o  username  +                o  VMS-hashed Basic passwordl  0                o  MD5-generated Digest passwords  ?                o  capabilities (can the user read, write, etc.)e  2             15-6  Brief Introduction to HTTPd Code    4            !                o  contact details   #                o  significant dates   &                o  significant counters  B                Server-host SYSUAF authentication is also provided.               15.8.3 BASIC.C  &                <online hypertext link>  H                This module provides authentication functionality for the                BASIC method.               15.8.4 DCL.C  &                <online hypertext link>  '                MAJOR REVISION FOR v4.2!   L                The DCL execution functionality must interface and coordinateK                with an external subprocess. It too is asynchronously drivensK                by I/O once the subprocess has been created and is executing L                independently. Communication with the subprocess (IPC) is via                mailboxes.H  J                Process creation by the VMS operating system is notoriouslyE                slow and expensive. This is an inescapable factor when I                scripting using child processes within the environment. An J                obvious strategy is to avoid, at least as much as possible,G                the creation of subprocesses. The only way to do this is G                to share subprocesses between multiple scripts/requests.bG                The obvious complication becomes isolating the potentialAD                interactions due to changes made by any script to theJ                subprocess' enviroment. For VMS these changes are basicallyH                symbol and logical name creation, and files opened at theJ                DCL level. In reality few scripts need to make logical nameH                changes and symbols are easily removed between uses. DCL-H                opened files are a little more problematic, but again, inK                reality most scripts doing file manipulation will be images._  F                The conclusion becomes that for almost all environmentsE                scripts can quite safely share subprocesses with greatoJ                benefit to response latency and system impact. If the localM                environment requires absolute script isolation for some reason M                then this subprocess-persistance may easily be disabled with ae3                consequent trade-off on performance.   G                The term zombie is used affectionately to describe these K                subprocesses when persisting between uses (the reason should.J                be obvious, they are neither "alive" (processing a request)0                nor are they "dead" (deleted) :^)  N                                         Brief Introduction to HTTPd Code  15-7    p            7                The DCL facility is used in three modes:   6                1. To execute independent DCL commands.J                   This is used to provide DCL command output for SSI (pre-H                   processed HTML). Subprocesses will exist over multiple4                   commands (if zombies are enabled).  2                2. To execute standard CGI scripts.L                   Subprocesses will exist over multiple requests (if zombies                   are enabled).   -                3. To execute CGIplus scripts.nM                   Subprocesses will exist over multiple requests. TechnicallypH                   the CGIplus script only executes once and then remainsE                   blocking until a request is provided to it. It theneL                   processes the request, provides output, then blocks again.#                   See Section 11.6.   J                The DCL module creates a data structure that allows subpro-M                cesses to be managed independently of any request. This allowsiI                both CGIplus and standard CGI subprocesses (in the form ofaH                zombies) to persist across multiple requests. There are aL                fixed number of subprocesses that can exist for all purposes.I                This is set by the subprocess hard-limit configuration pa-eI                rameter. Each of these structures is created and populatediL                on an as-required basis, linked into a list growing from zeroJ                to maximum based on demand and the life of the server. Sub-K                processes can come and go depending on requirements. CGIpluskI                script subprocesses and any zombies are semi-permanent. Ine                summary:.  M                o  Four mailboxes and a SYS$OUTPUT data buffer are permanently 5                   associated with each DCL structure.o  L                o  With CGIplus a subprocess semi-permanently associated with$                   the DCL structure.  J                o  Other activities, standard CGI scripts and DCL commands,M                   can maintain similar semi-permanent subprocesses as zombieswK                   if configured, or they create and delete a subprocess forl5                   each use if zombie use is disabled.   M                o  For a CGIplus script request the list of data structures is I                   searched for an idle subprocess providing the requested G                   script. If one is found the request is allocated that L                   structure. If all existing are busy or none exists at thatK                   time an idle zombie (if enabled) is searched for and usednL                   if found. Failing that an empty structure is searched for,I                   a subprocess created and the request allocated to that.,  2             15-8  Brief Introduction to HTTPd Code f               F                o  For standard CGI script and DCL command execution anI                   idle zombie (if enabled) is used. Failing that an emptytI                   structure (no associated subprocess) is searched for, aCG                   subprocess created and the request allocated to that.u  I                o  Structures may be added to the list until a hard-limit,fL                   is reached. However when a soft-limit threshold is reachedH                   the list is searched for idle CGIplus structures (i.e.L                   subprocess executing but no associated request). The leastI                   used of any of these idle structures has the subprocesseE                   deleted freeing that slot for reuse. This is termedi                   purging.  ?                The four mailboxes serve as the subprocess' IPC:S                  1. SYS$COMMAND J                   This stream controls the subprocess execution, providingK                   DCL commands to the subprocess' CLI. For DCL commands andsJ                   standard CGI it creates DCL symbols representing the CGIC                   variables then the command or script is executed.l                  2. SYS$OUTPUTJ                   The subprocess simply writes output to SYS$OUTPUT (<std-J                   out>). Due to buffering in the C RTL binary-mode streamsL                   are more efficient and faster than record-mode. See any ofK                   the CGI applications in this package for example code foriJ                   changing script <stdout> to binary-mode. CGIplus scriptsJ                   must indicate the end of a single request's output usingL                   a special EOF string which is specifically detected by theM                   output functions. As this mailbox persists between requestseI                   it is essential to ensure no output from a previous re-iM                   quest lingers in the mailbox due to request concellation orp2                   abnormal subprocess termination.                  3. SYS$INPUT H                   For CGI script execution, available for the subprocessM                   access to the HTTP data stream as <stdin>. A synonym existsmL                   for backward compatibility, the logical name HTTP$INPUT, a8                   stream which can be explicitly opened.  H                   NOTE: Versions of the server prior to 4.3 supplied theM                   full request (header then body) to the script. This was not M                   fully CGI-compliant. Versions 4.3 and following supply only M                   the body, although the previous behaviour may be explicitly D                   selected by enabling this configuration parameter.                  4. CGIPLUSINuI                   For CGIplus this mailbox provides access to a request's L                   CGI variables. The first line of any request can always beM                   discarded (for synchronization) and end-of-request vriablescL                   is indicated by an empty record (blank line). For standard@                   CGI and DCL commands this mailbox is not used.  N                                         Brief Introduction to HTTPd Code  15-9    m            $                DCL Module Processing  D                1. The primary DCL function ensures any required fileF                   specification exists (e.g. script procedure). It theL                   allocates a slot to the request. Slot allocation is a very'                   fundamental activity:v  J                   A function writes to the CGIPLUSIN, creating a number ofM                   logical names, CGI-compliant symbol names and executing thepM                   command or invoking the execution of a DCL procedure, etc., J                   and supplies the CGIplus variable stream if appropriate.K                   If the use of zombies is enabled then DCL to clean up the D                   environment as much as possible is provided first.  M                2. When the subprocess writes to the SYS$OUTPUT stream the I/OlM                   completion AST routine associated with reading that mailboxo                   is called.  L                   If CGIplus script execution the I/O is always examined forM                   the CGIplus end-of-output signature bits. It must always bebK                   at the start of the record and if detected the request isc                   concluded.  L                   If CGI script execution, the first I/O from this stream isM                   analyzed for CGI-compliance. It is determined whether a rawtM                   HTTP data stream will be supplied by the script, or whetherdM                   the script will be CGI-compliant (requiring the addition ofdL                   HTTP header, etc.) and whether HTTP carriage-control needs6                   to be checked/added for each record.  K                   A CGI local redirection header (partial URL) is a speciallL                   case. When this is received all output from the subprocessJ                   is suppressed until the script processing is ready to beL                   concluded. At that time the "Location:" information of theJ                   header is used to reinitiate the request, using the same(                   thread data structure.  J                   When normal SYS$OUTPUT processing is complete the recordJ                   received can be handled in one of two ways. If it is rawG                   HTTP it is asynchronously written to the network. TheeI                   AST completion routine specified with the network write F                   will queue another read from subprocess' SYS$OUTPUT.I                   If it is record-oriented I/O (e.g. from DCL output), itoG                   has it's carriage-control checked for HTTP compliancenJ                   before asynchronously writing the record. Hence a scriptK                   supplying its own raw, HTTP-compliant data stream is much 3                   more efficient than line-by-line.a  M                   The SYS$OUTPUT stream is a little problematic. For standard L                   CGI and DCL command execution at subprocess exit there mayK                   be one or more records waiting in the mailbox for readingdH                   and subsequent writing to the client over the network,L                   delaying processing conclusion. Detection of completion is  3             15-10  Brief Introduction to HTTPd Code     c            M                   accomplished by making each QIO sensitive to mailbox statuseJ                   via the SS$_NOWRITER status, which indicates there is noL                   channel assigned to the mailbox, and the mailbox buffer isM                   empty. It then becomes safe to dispose of the client thread '                   without loss of data.t  K                3. If CGI-script execution is for a POST or PUT metthod, the H                   HTTP data stream made available is also AST driven. IfL                   the subprocess opens the stream and reads from it, the I/OL                   completion routine called queues another asynchronous read?                   from the buffered request header and/or body.                15.8.5 DESCR.C  &                <online hypertext link>  !                INCOMPLETE AS YET!   K                The Descr.c module generates a file description by searching J                HTML files for the first occurance of <TITLE>...</TITLE> orJ                <Hn>...</Hn> tags, using the description provided there-in.L                It is primarily used by the directory listing module, but can/                also be used by the menu module.   F                It does this search asynchronously (surprise-surprise!)  J                To asynchronously locate a description in an HTML file, theJ                file is opened and then each record asynchronously read andL                examined for the <TITLE> element. Once obtained a synchronousI                call is made to a function to list the file details. After2K                the file details are listed another asynchronous search callSG                is made, with the file search function specified for AST C                completion. The function then immediately completes.n               15.8.6 DIGEST.CI  &                <online hypertext link>  H                This module provides authentication functionality for the                DIGEST method.S  L                This module uses code derived in part from RSA Data Security,#                Inc., under licence:   J                granted to make and use derivative works provided that suchK                works are identified as "derived from the RSA Data Security, L                Inc. MD5 Message-Digest Algorithm" in all material mentioning/                or referencing the derived work.     N                                        Brief Introduction to HTTPd Code  15-11 .                            15.8.7 DIR.C  &                <online hypertext link>  L                There is some fairly complex and convoluted behaviour in this                code!  M                This module implements the HTTPd directory listing functional- I                ity. Directories are listed first, then files. File detail G                format customizable, with the default resembling the de-uI                fault CERN and NCSA server layout. Output from this module H                is buffered to reduce network writes, improving I/O effi-L                ciency. HTML files have the <TITLE></TITLE> element extracted'                as a "Description" item.M  #                Essential behaviour:   J                1. The primary function obtains the file specification fromL                   the request data structure. Server directives, controllingH                   some features of the directory listing beahaviour, areF                   checked for and parsed out if present. The directoryL                   listing layout is initialized. The directory specificationJ                   (path information) is parsed to obtain the directory andG                   file name/type components. After successfully parsingeH                   the specification it generates an HTTP response header                   if required.  L                2. Column headings and (possibly) a parent directory item areM                   buffered in an asynchronous function call. An RMS structurehI                   is initialized to allow the asynchronous search for all D                   files in the specified directory ending in ".DIR".  H                3. For each directory file found the directory search ASTF                   completion function is called. Status is checked forJ                   success or otherwise. If an error the status is reportedL                   to the client and the request processing concluded. If theJ                   directory contained no directory files, or the directoryM                   files are exhausted a call to a function to begin a listingLF                   of non-directory files is made and the function then                   completes.  M                   If a directory file was returned a synchronous call to list H                   the details of that directory is made and then anotherF                   asynchronous search call made with an AST completion7                   function again back to this function.s  M                4. When the directory files are exhausted the RMS structure istJ                   reinitialized to allow the search for all specification-D                   matching, non-directory files in the directory. An3                   asynchronous search call is made.   3             15-12  Brief Introduction to HTTPd Codes l               M                5. For each matching file found the file search AST completion F                   function is called. Status is checked for success orM                   otherwise. If an error the status is reported to the clientcM                   and the processing concluded. If the directory contained norL                   matching files, or the files are exhausted, the processingF                   is concluded and the function immediately completes.  M                   If a file was returned a call is made to the Descr.c moduleeK                   to check whether a file description can be obtained (HTMLmL                   files only). If it can then this module is use to generateI                   it and the function completes. If no description can betK                   obtained a synchronous call is made to a function to listuM                   the file details. After the file details are listed anothermJ                   asynchronous search call is made, with the same functionM                   specified for AST completion. The function then immediatelyi                   completes.               15.8.8 FILE.C   &                <online hypertext link>  F                This module implements the file transfer functionality.F                It obtains the file specification and mime content typeF                information from the request data structure. It handlesH                VARIABLE or VFC files differently from STREAM, STREAM_LF,I                STREAM_CR, FIXED and UNDEFINED. With STREAM(_*), FIXED and K                UNDEFINED files the assumption is that HTTP carriage-controleI                is within file itself (i.e. at least the newline (LF), alloH                that is required required by most browsers), and does notH                require additional processing. With VARIABLE, etc., filesH                the carriage-control is implied and therefore each recordI                requires additional processing by the server to supply it. H                Record-oriented files will have multiple records bufferedI                before writing them collectively to the network (improvinglG                efficiency). Stream and binary file reads are by VirtualiG                Block, and are written to the network immediately makingeI                the transfer of these very efficient indeed! The essentiali2                behaviour however is much the same.  F                If conversion to STREAM_LF files is enabled this moduleK                will, upon encountering a VARIABLE or VFC file, initiate its L                conversion to STREAM_LF record format. This is done using the6                StmLf.c <online hypertext link> module.  L                (Versions prior to 3.2 used a configuration directive for theK                MIME content-type to determine whether a file was transferedoJ                record-by-record or in binary. This is no longer required.)  G                1. The primary function allocates a task structure. ThisfI                   function then gets some file information using ACP I/O.vM                   If the file does not exist it immediately returns the errorGH                   status to the calling routine for further action (this  N                                        Brief Introduction to HTTPd Code  15-13 U  a            I                   behaviour is used to try each of multiple home pages by I                   detecting file- not-found, for example). If it does the G                   ACP information provides modification date/time, sizesI                   and record-format. If the record format is VARIABLE andmK                   STREAM-LF conversion is enabled, conversion is initiated.,I                   If the request specified an "If-Modified-Since:" header K                   line the modification date is checked and a possible "304e3                   Not Modified" response generated.h  J                2. After successfully opening the file it generates an HTTPJ                   response header if required. It then calls one of eitherJ                   two functions to queue the first read from the file, oneG                   for variable-record files (record-oriented transfer),fJ                   another for stream (STREAM-LF and stream record formats)L                   text and binary files (block-oriented transfer). After theG                   read is queued it returns with a success status code.   I                3. When the asynchronous file read completes one of eitheriH                   two AST completion functions (one for record the otherI                   for block) is called to post-process the I/O. Status iseJ                   checked for success or otherwise. If an error the statusM                   is reported to the client, the file closed, and the request #                   thread concluded.s  I                   If end-of-file, the file is closed, for record-oriented(J                   files the buffer checked and if necessary flushed. If anJ                   end task function was specified control is now passed to:                   that, otherwise the thread is concluded.  K                   If not end-of-file, for record files multiple records mayoM                   be buffered before writing to the network. If the buffer is L                   full (the read was unsuccessful due to insufficient space)I                   the contents are asynchronously written to the network, H                   with the network write completion routine specifying aK                   function to re-read the the file record that just failed. L                   If there is still space in the buffer another asynchronousH                   read of the file is queued in an attempt to append theK                   next record into the buffer. After the read is queued theo%                   function completes.G  L                   If not end-of-file, for stream and binary files a success-J                   ful read results in a call to the network write functionL                   to send this to the client. This call contains the addressJ                   of the function to read the next blocks from the file asK                   an AST completion routine. After the asynchronous network 9                   write is queued the function completes.         3             15-14  Brief Introduction to HTTPd Codea n  p            M                For text files the contents can be encapsulated as plain text. J                This involves prefixing the file send with a <PRE> HTML tagK                and postfixing it with a </PRE> tag. The buffer is filled as L                per normal but when ready to output a function is called thatJ                escapes all HTML-forbidden characters first (e.g. "<", ">",;                "&", etc.) This is used by the SSI.C module.                15.8.9 HTADMIN.C  &                <online hypertext link>  !                INCOMPLETE AS YET!r  H                The HTAdmin.c module allows on-line administration of the7                HTTPd-specific authentication databases.                15.8.10 HTTPD.Cf  &                <online hypertext link>  K                This is the main()  module of the server. It performs serveru$                startup and shutdown.               15.8.11 ISMAP.Ct  &                <online hypertext link>  M                The clickable-image support module provides this functionalitytE                as an integrated part of the server. It supports image F                configuration file directives in either of NCSA or CERNM                formats. Extensive configuration specification error reporting $                has been implemented.  6                                        Acknowlegement:  A                      Three coordinate mapping functions have been)@                      plagiarized from the NCSA IMAGEMAP.C scriptC                      program. These have been inserted unaltered in B                      the module and an infrastructure built around?                      the essential processing they provide. Duen?                      acknowlegement to the original authors andtH                      maintainers of that application. Any copyright over?                      portions of that code is also acknowleged:   $                        ** mapper 1.2K                        ** 7/26/93 Kevin Hughes, kevinh@pulua.hcc.hawaii.edu c                        ** "macmartinized" polygon code copyright 1992 by Eric Haines, erich@eye.comp  #                Essential behaviour:i  E                1. The primary function allocates a task structure andIF                   then attempts to open the map configuration file. If  N                                        Brief Introduction to HTTPd Code  15-15 e  a            I                   unsuccessful it generates an error report and concludes                    processing.t  F                2. After successfully opening the configuration file itH                   extracts the client-supplied coordinate from the queryM                   string. A call is then made to asynchronously read a recordtH                   (line) from the configuration file. Configuration file=                   processing is asynchronous from that point.   H                3. The record (line) read AST function checks for end-of-J                   file, when it will return the default URL (if supplied).L                   After end-of-file the file is closed and the processing is                   concluded.  G                   If not end-of-file, a function is called to parse theoL                   record for an image mapping directive. When the componentsK                   have been parsed the NCSA IMAGEMAP.C routines are used to M                   determine if the click coordinates are within the specified %                   region coordinates.   F                   If it is within the region the click has been mappedG                   and the URL is placed in heap memory and the thread'stE                   redirection location pointer set to it. The file isbL                   closed and the processing conclusion function called. ThisJ                   function detects the redirection location and if a localI                   URL instead of disposing of the thread generates a new,dI                   internal request from the redirection information. In aaM                   non-local URL the client is sent a redirection response and ,                   then the thread concluded.  I                   If not within the region a call is made to asynchronous C                   read the next record from the configuration file.s               15.8.12 LOGGING.Cn  &                <online hypertext link>  F                The logging module provides an access log (server logs,K                including error messages are generated by the detached HTTPdoI                process, see sections Server Process Logging Directory andi                 Section 5.3.2.4).  E                The access log format can be that of the Web-standard,eL                "common"-format, "common+server"-format or "combined"-format,M                along with user-definable formats, allowing processing by mostt"                log-analysis tools.  C                The "common"-format entries (record, line) comprise:S  Z                   client_host r_ident auth_user [time] "request" reponse_status bytes_sent                  where:   B                o  client_host is from where the request originated  3             15-16  Brief Introduction to HTTPd Codeu e               E                o  r_ident is the user identified by the client host's8K                   authentication daemon (RFC931), this is not available andL*                   is always a hyphen ("-")  K                o  auth_user the authenticated user-name associated with the ,                   request, or a hyphen ("-")  H                o  time the following format: dd/mmm/yyyy:hh:mm:ss +/-GMT6                   (e.g. "16/Dec/1995:21:15:34 +10:30")  J                o  request the method, a space, then the path and any query                   string  L                o  response_status the three digit response status code (e.g.                   200, 302)f  I                o  bytes_sent the number of bytes sent to the client, or ae                   hyphen ("-")  J                The "common+server"-format entry appends the server name toB                the common-format entry (for multi-homed services).  G                The "combined"-format entry appends quote-delimited, the J                referer and then the user-agent to the common-format entry.  H                In addition to legitimate request entries the server addsI                bogus entries to the "common"-format log for time-stampingoL                server startup, shutdown, and the log being explicitly openedK                or closed (see Section 5.3.2.4). These entries are correctlycJ                formatted so as to be processed by a log analysis tool, andK                are recognisable as being "POST" method and coming from usertM                "HTTPd". The request path contains the event and a hexadecimal-K                VMS status code, that represents a valid exit status only inh                "END" entries.   L                Clickable-image requests are logged as "302" entries, and theB                resulting, redirected request entry logged as well.  I                When a log entry is required the file is opened if closed.oM                The file is again closed one minute after the initial request.TE                This flushes the contents of the write-behind buffers.                15.8.13 MENU.C  &                <online hypertext link>  H                This module implements the WASD menu interpretation func-L                tionality. It obtains the file specification from the requestL                data structure. Output from this module is buffered to reduce8                network writes, improving I/O efficiency.  #                Essential behaviour:E  J                1. The primary function allocates a task structure and thenK                   attempts to open the file. If unsuccessful it immediatelyrM                   returns the error status to the calling routine for furtherb  N                                        Brief Introduction to HTTPd Code  15-17 y               L                   action (this behaviour is used to try multiple home pages,I                   for example). No checking of modification date/times is L                   done as menu documents are considered dynamic in a similar'                   way to SSI documents.s  J                2. After successfully opening the file it generates an HTTPE                   response header if required. A call is then made torJ                   asynchronously read a record from the file opened. AfterK                   the asynchronous file read is queued the function returnse-                   with a success status code.   K                   When the asynchronous file read completes the AST comple- J                   tion function is called to interpret the line, dependantK                   on the section number it occurs in. Status is checked for J                   success or otherwise. If an error the status is reportedL                   to the client, the file closed, and the request concluded.L                   If end-of-file, the file is closed and the processing con-J                   cluded. For a successful record read the line can eitherM                   be title, description or menu item. When the line is inter-oK                   preted and written to the network another read is queued,nJ                   with an AST completion routine again specifying the con-M                   tents interpretation function. The function then completes.                15.8.14 MSG.Cf  &                <online hypertext link>  H                The message database for the server is maintained by thisH                module. Some structures are fixed in size at compilation,L                but the actual messages themselves are stored using allocatedF                memory so each and all may be of greatly variable size.  <                There are three main functions in the module.  I                1. MsgLoad() Loads a message database. Is called at server K                   startup and whenever a report is to be generated from the                    message file.d  I                2. MsgFor() Called each time the server needs to provide alH                   message that originates from the database. The requestI                   pointer (if available) and the message number (from theaG                   defined-by-macro number in msg.h) are supplied. If noaG                   request pointer the prefered language is used (lowestIJ                   number). If there is a request pointer it is checked forI                   a prefered language before getting that message pointers>                   from whichever language array is to be used.  J                3. MsgReport() This is called via the server administrationJ                   menu to provide an HTML-formatted listing of messages inJ                   the server's volatile database or from the on-disk file.F                   For the on disk file it calls MsgInit() with a localI                   message structure, completely loading a new instance ofe  3             15-18  Brief Introduction to HTTPd Codee i  i            J                   all messages from the file, displays the report and then#                   disposes of them.V               15.8.15 NET.CE  &                <online hypertext link>  E                This module handles all TCP/IP network activites, fromDG                creating the server socket and listening on the port, toiM                reading and writing network I/O. It manages request initiationrL                and rundown, and controls connection persistence. The networkI                read and write functions have provision for specifying I/OoL                completion AST function addresses. If these are provided thenI                the function is called upon completion of the network I/O.lL                If not provided then the I/O completes without calling an AST                routine.(  I                As of v4.3 this module supports the MadGoat NETLIB networkiJ                progamming package. This excellent freeware tool provides aH                generic, asynchronous interface to a number of underlyingI                TCP/IP packages. It behaves in much the same manner as the K                $QIO interface and so dove-tails perfectly into this server.,F                It took less that eight hours to build support into theL                original UCX version for NETLIB! To avoid complete dependenceF                on, and the slight extra overhead of NETLIB, both a UCXJ                version and a NETLIB version are maintained via conditional*                compilation using C macros.  F                The server begins by creating a network socket and thenG                binding that to the HTTP port. The server then enters ant9                infinite loop, waiting for IP connections.i  G                When a connection request is received the remote host is K                checked as an allowed connection. If allowed, a request datanL                structure is created from dynamic memory, and an asynchronousJ                read is queued from the network client. The pointer to thisH                dynamic data structure becomes the request thread, and isL                passed from function to function, AST routine to AST routine.H                The AST completion routine of the network request read(s)G                specifies a request analysis function. The function thenE9                returns to the connection acceptance loop.   K                When the network read(s) complete an AST completion function E                in the Request()  module is called to process the HTTP                 request.i  H                This module also contains the code for the BufferOutput()6                function described above, Section 15.4.    N                                        Brief Introduction to HTTPd Code  15-19 e  e                         15.8.16 PUT.C   &                <online hypertext link>  !                INCOMPLETE AS YET!   H                The PUT module allows files to be uploaded to, and storedL                by, the server. It also allows the deletion of files, and theM                creation and deletion of directories. This same module handles F                PUT, POST and DELETE methods appropriately. It requiresL                authorization to be enabled on the server. Created files have-                a three-version limit applied.t  K                The Request.c module controls the size of any request POSTedtI                or PUTed via a configurable parameter limiting the size in L                Kilobytes. The request is completely read by that same moduleJ                before being parsed and handed over to the Put.c module (orH                DCL.c if a script). Hence the Put.c module has a completeB                request body pointed in-memory that it can process.  K                POSTed or PUTed requests are processed differently accordinge(                to the MIME content-type:  3                o  application/x-www-form-urlencodedw  D                   The server specially processes "application/x-www-A                   form-urlencoded" POSTS (i.e. those generated byyI                   <FORM>...</FORM>, allowing files to be created directlyiL                   from HTML forms. The processing eliminates any field namesM                   from the URL-encoded data stream, placing only field valuesnK                   into the file. This capability can be quite useful and isd9                   demonstrated in the Update HTTPd module   /                   <online hypertext link>. form   %                o  multipart/form-data   J                   This server can process a request body according to RFC-L                   1867, "Form-based File Upload in HTML". As yet it is not aL                   full implementation. It will not process "multipart/mixed"G                   subsections. The implementation is basic, providing a H                   facility to allow the upload of a file into the serverH                   administered file system. The ACTION= parameter of theJ                   <FORM> tag must specify the directory (as a URL path) in:                   which the uploaded file will be created.  J                   The following example HTML illustrates how a form may beJ                   used to upload a file from the browser host file system:  \                    <FORM METHOD=POST ACTION="/web/directory/" ENCTYPE="multipart/form-data">D                    <INPUT TYPE=submit VALUE=" Upload document ... "><                    <INPUT TYPE=file SIZE=50 NAME=uploadfile>                    </FORM>  )                   <online hypertext link>   3             15-20  Brief Introduction to HTTPd CodeT H  m            M                   NOTE: This capability has only been tested against NetscapeiJ                   Navigator versions 2 and 3. VMS Netscape Navigator 3.0b5H                   hangs if an upload of a variable-record format file isM                   attempted. Stick to STREAM-LF or fixed, or convert the file M                   to STREAM-LF. Windows-based Navigator will hang if the filebG                   is open by another application (e.g. Microsoft Word).n                  o  any/other   L                   Any other content type has a file created according to theK                   path. If it is a text file the VMS record type is STREAM-oH                   LF (e.g. "text/plain", "text/html"). Any other type isM                   considered binary and the created file is made an UNDEFINEDpM                   record type (e.g. "image/gif", "application/octet-stream").A  M                The parent directory of any file/directory operation is always M                checked for permission to modify its contents. This permission H                is usually granted to the HTTPd account via an ACL. FilesK                are written using Virtual Block I/O. This can make them verysM                efficient. They are handled asynchronously, not disturbing the -                multi-threading of the server.                15.8.17 REQUEST.C   &                <online hypertext link>  K                This module reads the request header from the client, parsespL                this, and then calls the appropriate task function to executeJ                the request (i.e. send a file, SSI an HTML file, generate a9                directory listing, execute a script, etc.)r  J                The request header is contained in the network read buffer.K                If it cannot be completely read in the first chunk, the readeJ                buffer is dynamically expanded so as to be read in multipleL                chunks. The request header is addressed by a specific pointerK                that allows the parse-and-execute function to process either K                a genuine, initial client request header, or a pseudo-header 1                generated to effect a redirection.t  L                The method, path information and query string are parsed fromK                the first line of the header. Other, specific request header I                fields are also parsed out and stored for later reference. F                Once this has been done the header is not further used.  I                Once the relevant information is obtained from the requestnG                header processing commences on implementing the request.iH                This comprsises the rule-mapping of any path information,J                the RMS parsing of any resulting VMS file specification and=                decision-making on how to execute the request.c  <                o  If an internal directive that is executed.  I                o  If the content-type of a supplied file specification isyH                   auto-scripting, an automatic redirection is generated.  N                                        Brief Introduction to HTTPd Code  15-21 l               L                o  If a file specification and no wildcards, the file is sent                    to the client.  L                o  If a wildcarded file specification, and no query string, a1                   directory listing is generated.-  E                o  If a directory specification (no file name), one of J                   multiple, possible, home pages are attempted to be sent.L                   If no home page is found in the directory then a directory'                   listing is generated.8  I                o  If a script specification prefixed the path informatione*                   that script is executed.  G                o  If a query string is supplied (and it is not a servercI                   directive), and no script name was included in the patheG                   information, the server query script is automatically                    activated.  G                This functionality is used to parse and execute both thecF                initial client request and any pseudo-request generated2                internally to effect a redirection.  J                If a POST/PUT method is used the entire request body (usingM                the "Content-Length:" header line to determine length) is alsosL                read into dynamic memory before passing to the PUT.C or DCL.C&                modules for processing.               15.8.18 SSI.Cu  &                <online hypertext link>  L                The Server Side Includes (HTML pre-processor) module providesF                this functionality as an integrated part of the server.L                Output from this module is buffered to reduce network writes,(                improving I/O efficiency.  #                Essential behaviour:n  D                1. The primary function attempts to open the file. IfM                   unsuccessful it immediately returns the error status to the L                   calling routine for further action (this behaviour is usedI                   to try multiple home pages, for example). SSI documentssL                   can be dynamic in undetectable ways so no checking of file1                   modification date/time is done.   J                2. After successfully opening the file it generates an HTTPE                   response header if required. A call is then made to H                   asynchronously read a record from the file opened. TheJ                   record read AST function scans the record (line) lookingG                   for pre-processor directives embedded in HTML commenteK                   directives. If no directive is found the record is outputa9                   buffered and another queued to be read.u  3             15-22  Brief Introduction to HTTPd Code  o  l            H                3. If a directive is detected any part of the line up theG                   directive is output buffered and a function called toiL                   parse the directive. This function reports an error if theK                   directive specified is not supported (unknown, etc.) If auM                   supported directive a specific function is called accordingiI                   to the directive specified. These functions provide the,@                   pre-processor information in one of four ways:                     1. Internally   J                      Information such as the system time, current documentH                      information, etc., can be provided from informationK                      contained in the request data, etc., or in the case ofEN                      specified document/file information obtained via the fileK                      system. These directives have the relevant informationiL                      buffered and then the function returns to the directive&                      parsing function.  &                   2. Via DCL Execution  L                      Information that must be obtained through DCL executionH                      is obtained using an asynchronous call to the Dcl()G                      module. The next-task function is specified as the L                      line parsing function. When the DCL module has finishedM                      executing the required command control is passed back to #                      this function.(  #                   3. Sending a Fileh  D                      If a file is #included this is provided with anJ                      asynchronous call to the File() module. The next-taskM                      function is specified as the line parsing function. When L                      the File() module has finished transfering the includedB                      file control is passed back to this function.  &                   4. Directory Listing  M                      If a directory listing is requested this is provided viatL                      an asynchronous call to the Dir() module. The next-taskM                      function is specified as the line parsing function. When I                      the Dir() module has finished generating the listing =                      control is passed back to this function.   G                4. Directives continue to be parsed, and executed, asyn- J                   chronously if necessary (as just described), from withinH                   a line until the end-of-line is reached. Any remainingK                   characters are output buffered. Lines continue to be readrJ                   from the file using the AST mechanism until end-of-file.    N                                        Brief Introduction to HTTPd Code  15-23                              15.8.19 STMLF.Ca  &                <online hypertext link>  M                The stmLF.c module converts VARIABLE format records to STREAM-8I                LF. It is only called from the File.c module and only thenmE                when STREAM-LF conversion is enabled within the serverd                configuration.i  M                The conversion is done asynchronously (naturally) concurrentlyrE                with any reads being performed by the File.c module inaC                transfering the file to the client. After successfuln6                conversion the original file is purged.               15.8.20 SUPPORT.C   &                <online hypertext link>  L                The support module provides a number of miscellaneous support:                functions for the HTTPd (well go-o-o-lee!).               15.8.21 UPD.Ce  &                <online hypertext link>  !                INCOMPLETE AS YET!   D                The Upd.c module implements the on-line web directoryF                administration and file editing and upload facility. ItG                requires authorization to be enabled on the server. FileuJ                and directory modification are still performed by the Put.cK                module. The Upd.c is an overly large body of code generatingmG                all of the dialogues and editing pages. It also provides M                additional functionality for the server administration, adding @                admin-specific portions of dialogues as required.                              3             15-24  Brief Introduction to HTTPd Codes