z/OS DGW Migration FAQ

Other sources of information

Migration redpaper

Infocenter

Unsupported contributed config migration tool here: ftp://public.dhe.ibm.com/s390/zos/tools/cmt/

Informal document comparing both HTTP servers and their directives

GWAPI / Module development resources

ZOS Questions FAQ for information about IBM HTTP Server on z/OS.

URL mapping questions

Problems with double-slashes

Domino by default "simplifies" URL paths that contained double-slashes, such as http://www.example.com/icons//spacer.jpg. While these do not affect mapping of URL paths to the filesystem, they can affect other modules that work on the URI directly, such as the WAS WebServer Plug-in.

IHS prior to 9.0.5.0 did NOT merge these consecutive slashes, but 9.0.5.0 and later do it by default as well.

Here is a recipe to remove one double-slash from the URL path for 9.0.0.11 and earlier:

Uncomment LoadModule for mod_rewrite near top of httpd.conf

Once at bottom of httpd.conf and once in each <VirtualHost>:

    RewriteEngine ON
    # Remove first double-slash from the path component of the URL
    RewriteRule ^(.*)//+(.*)$ $1/$2 [PT]

Translation questions

Are there any locale (LC_*) differences between DGW and IHS?

IHS doesn't call setlocale(LC_ALL, ""), so setting LC_* variables doesn't have any direct affect on locale-sensitive standard library calls.

CGI questions

Why isn't _BPX_USERID set for my CGI environment?

Domino unnecessarily set _BPX_USERID in a CGI's environment even though it already changed userids. Apache does not currently set this variable, but you can copy the "REMOTE_USER" variable to this variable to allow existing scripts to continue to function unchanged.

    <Location /cgi-bin/test-cgi>
      # Example of SAF-authenticated resource.
      Authtype basic
      AuthName foo
      AuthBasicProvider saf
      Require valid-user
      SafRunAs  %%CLIENT%%
    
      # Copy REMOTE_USER to _BPX_USERID. Note that this only works when mod_rewrite
      # is configured in "directory" context. You cannot put this outside of
      # Location/Directory, as it will run prior to authentication.
      Options +FollowSymlinks
      RewriteEngine ON
      RewriteCond %{REMOTE_USER} (.+)
      RewriteRule .* - [E=_BPX_USERID:%1]
    </Location>

FSCP and NETCP environment variables

These variables are not set by Apache. If you depend on them being set as a global configuration for a CGI, set them with SetEnv.

Why doesn't 'PULL PARSE' work in a REXX CGI?

If the POST body is not newline-terminated, PULL PARSE won't read any data. There is no reason for a POST body to be newline terminated. DGW had a workaround to accomodate this by adding data to the users POST body. Apache doesn't modify the body in this way.

Why do REXX reads of POST data return partial results?

REXX I/O calls that try to read the HTTP POST body in a single read, such as read 0 var 13766 are likely to only return partial results or work erratically. Generally, when reading from a socket or a pipe, I/O routines that read into non-trivial sized buffers should always be called in a loop.

Apache communicates with CGI scripts via a pipe, and the writing side of a pipe typically cannot write more than 4096 bytes before the reading side begins to consume the data. The POSIX standard only requires that pipes have a 512 byte buffer.

Below if a brief routine using a 4k chunk size:

ReadPostData:
 body = ""                                      /* Initialize buffer    */
 chunkSize = 4096                               /* Input buffer size      */
 Do FOREVER                                     /* Read POST string chunks   */
  chunk = Copies(" ",chunkSize)                 /* Initialize chunk buffer   */
  Address LINKMVS 'IMWXRD chunk'                /* Attempt to read next chunk  */
  Say "BLMWSWRT: Length(chunk)" Length(chunk)
  If RC \= 0 then Leave                         /* All data has been read    */
  body = body || chunk                          /* Collect data         */
 End                                            /* Read POST string chunks   */
 Drop chunk                                     /*               */
Say "BLMWSWRT: RC:" RC "content-length" env.content_length,
 "bytes read:" Length(body)                     /* RC = 8: END-OF-DATA reached */
 Return                                         /*               */

How can a CGI opt out of otherwise configured translation?

Set CharsetOptions DGWCompat and then issue a response header of Content-Encoding: binary. This will be filtered out and short-circuit translation in 8.5.5 and later.

Authentication, authorization, and access control questions

What's the equivalent of the UserID directive?

While there is no direct equivalent, if UserID was being used to change to a different thread identity, mod_authnz_saf can do similar userid changes.