$!----------------------------------------------------------------------------- $! SINGLEBYTESTREAM.COM $! $! Small script to generate a stream of single bytes (as individual records) $! for testing/demonstrating the server's ability to coalesce these into 'real' $! records. Needs to be placed into [CGI-BIN] and then accessed using $! $! /cgi-bin/singlebytestream for empty record terminated lines $! /cgi-bin/singlebytestream?lf for record terminated lines $! /cgi-bin/singlebytestream/file/path[?lf] to return a specific file $! $! 24-JAN-2003 MGD initial $!----------------------------------------------------------------------------- $! $ withlf = 0 $ if WWW_QUERY_STRING .nes. "" then withlf = 1 $ fileName = f$environment("procedure") $ if WWW_PATH_TRANSLATED .nes. "" then fileName = WWW_PATH_TRANSLATED $! $ if f$search(fileName) .eqs. "" $ then $ write sys$output "Status: 404" $ write sys$output "" $ write sys$output "File ''fileName' not found!" $ exit $ endif $! $ fileType = f$parse(fileName,,,"type") $ contentType = "application/octet-stream" $ if fileType .eqs. ".COM" then contentType = "text/plain" $ if fileType .eqs. ".GIF" then contentType = "image/gif" $ if fileType .eqs. ".HTML" then contentType = "text/plain" $ if fileType .eqs. ".TXT" then contentType = "text/plain" $! $ line = "Content-Type: " + contentType $ call bout line withlf $ line = "" $ call bout line withlf $! $ open /read /error=cleanup file 'fileName' $ readLoop: $ read /error=readLoopEnd /end=readLoopEnd file line $ call bout line withlf $ goto readLoop $ readLoopEnd: $! $ cleanup: $ close file $ exit $! $!(output the string from the symbol named in P1 one byte/character at a time) $ bout: subroutine $ lf[0,8] = 10 $ length = f$length('p1') $ count = 0 $ byteLoop: $ if count .eq. length $ then $! (terminate the record) $ if 'p2' $ then write sys$output lf $ else write sys$output "" $ endif $ exit $ endif $ write sys$output f$extract(count,1,'p1') $ count = count + 1 $ goto byteLoop $ endsubroutine $!-----------------------------------------------------------------------------