$! 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 "
"
$ say "The script: HT_ROOT:[SRC.OTHER]GATEWAY_BG_EXAMPLE.COM"
$ 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 "This first section is coming courtesy of SYS$OUTPUT (''sysOutput')"
$ 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 "This second section is being output to the raw TCP/IP socket (''WWW_GATEWAY_BG')"
$ say "(note the absence of carriage-control except when explicitly added)"
$ 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