$!----------------------------------------------------------------------------- $! REQUEST_ERROR_MSG.COM $! $! Demonstrates various combinations of a script requesting the server $! generate an error message on it's behalf. $! Copy this into the server scripting directory (e.g. HT_ROOT:[CGI-BIN]) $! then access http://the.server.name/cgi-bin/request_error_msg $! $! 09-NOV-2002 MGD initial $!----------------------------------------------------------------------------- $ say = "write sys$output" $ if www_query_string .eqs. "" $ then $ say "Content-Type: text/html" $ say "" $ say "
" $ say "(Some components of these messages may not be " +- "generated depending on site error message configuration!)" $ say "
" $ say "" $ say "" $ exit $ endif $!---------------------------------------------------- $ if f$extract(0,7,f$element(1,"=",www_query_string)) .eqs. "Display" $ then $ say "Content-Type: text/plain" $ say "" $ type 'f$environment("procedure")' $ exit $ endif $!----------------------------------- $ if www_query_string .eqs. "do=1" $ then $ say "Status: 400" $ say "Script-Control: X-error-text=""Well actually it could! An example non-VMS status error message.""" $ say "" $ exit $ endif $!----------------------------------- $ if www_query_string .eqs. "do=2" $ then $ say "Status: 500" $ say "Script-Control: X-error-text=""a VMS status value generated report (REALLY!)""" $ say "Script-Control: X-error-vms-status=676" $ say "" $ exit $ endif $!----------------------------------- $ if www_query_string .eqs. "do=3" $ then $ say "Status: 000 (allows the server to generate it's own HTTP status code)" $ say "Script-Control: X-error-text=""/this/file/does/not.exist""" $ say "Script-Control: X-error-vms-status=%X00000910" $ say "Script-Control: X-error-vms-text=""THIS:[FILE.DOES]NOT.EXIST""" $ say "" $ exit $ endif $!----------------------------------- $ if www_query_string .eqs. "do=4" $ then $ say "Status: 403" $ say "Script-Control: X-error-text=""This message specifies the META module and line (check the HTML source).""" $ say "Script-Control: X-error-module=REQUEST_ERROR_MSG; X-error-line=999" $ say "Content-Type: text/html" $ say "" $ say "" $ say "ERROR 403: For other, less capable server environments :^)" $ exit $ endif $!----------------------------------- $ say "Status: 400" $ say "Script-Control: X-error-text=""Difficult to tell the difference, isn't it?""" $ say "" $!-----------------------------------------------------------------------------