[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
$! Demonstration of output direct to the client via the raw TCP/IP socket
$! 20-AUG-2000  MGD  initial
$! 22-AUG-2006  MGD  updated for changes to TCP/IP services
$!                   (open/write to a BG device seems to fail now-a-days)
$!                   add script-control to suppress encodings
$!
$ lf[0,8] = %x0a
$ say = "write sys$output"
$!
$ say "Content-Type: text/html"
$ say "Script-Control: x-content-encoding-gzip=0"
$ say "Script-Control: x-transfer-encoding-chunked=0"
$ say ""
$ say "<PRE>"
$ say "The script: <A HREF=""/ht_root/src/other/gateway_bg_example.com"">HT_ROOT:[SRC.OTHER]GATEWAY_BG_EXAMPLE.COM</A>"
$ say ""
$!
$ if f$type(WWW_GATEWAY_BG) .eqs. ""
$ then
$    say "There is no ""WWW_GATEWAY_BG"" CGI variable."
$    if f$type(WWW_REQUEST_SCHEME) .eqs. ""
$    then
$       say "There is no ""WWW_REQUEST_SCHEME"" CGI variable ... what gives?"
$       exit
$    endif
$    if WWW_REQUEST_SCHEME .eqs. "https:"
$    then
$       say "This is an SSL encrypted request (""https://"")."
$       say "Using the BG: device is not possible."
$       exit
$    endif
$    say "This indicates [DclGatewayBg] configuration directive is disabled."
$    exit
$ endif
$!
$ sysOutput = f$getdvi("SYS$OUTPUT","devnam") - "_"
$ say "<B><U>This first section is coming courtesy of SYS$OUTPUT (''sysOutput')</U></B>"
$ say ""
$ say "$ SHOW TIME"
$ show time
$ say "$ SHOW DEVICE /FULL SYS$OUTPUT:"
$ show device /full sys$output:
$ say "$ SHOW DEVICE /FULL ''WWW_GATEWAY_BG'"
$ show device /full 'WWW_GATEWAY_BG'
$!
$ say "<B><U>This second section is being output to the raw TCP/IP socket (''WWW_GATEWAY_BG')</U></B>"
$ say "<FONT COLOR=""#ff0000"">(note the absence of carriage-control except when explicitly added)</FONT>"
$ say ""
$ if WWW_QUERY_STRING .nes. ""
$ then
$!   (use a CGI callout to switch the carriage-control bit)
$    say WWW_GATEWAY_ESC
$    say "GATEWAY-CCL: " + WWW_QUERY_STRING
$    say WWW_GATEWAY_EOT
$!   (let the driver provide it's own carriage-control)
$    lf = ""
$ endif
$ prevSysOutput = f$trnlnm("SYS$OUTPUT")
$ define /process SYS$OUTPUT 'WWW_GATEWAY_BG'
$ say "$ SHOW TIME" + lf
$ show time 
$ say lf + "$ SHOW DEVICE /FULL SYS$OUTPUT:" + lf
$ show device /full sys$output:
$ say lf + "$ SHOW DEVICE /FULL ''WWW_GATEWAY_BG'" + lf
$ show device /full 'WWW_GATEWAY_BG'
$ define /process SYS$OUTPUT 'prevSysOutput'
$ exit