J. Blustein

Web-centric Computing

Some Example Code

SSI Test Page

This page looks different on

What works (and what doesn't)

  1. <!--#echo var="DATE_LOCAL" -->
    Friday, 08-Nov-2024 17:35:19 AST
  2. <!--#echo var="document_name" -->
    test1.shtml
  3. <!--#exec cmd="/usr/bin/echo exec works" -->
  4. Include virtual works on torch (see below)

Sometimes small differences matter...

  1. <!--#echo var="DATE_LOCAL" -->
    Friday, 08-Nov-2024 17:35:19 AST
  2. <!-- #echo var="DATE_LOCAL" -->

    Because of the extra space in the second example, the directive is not recognized

A whole lot of testing goin' on

  1. Date & Time

    1. <!--#echo var="DATE_LOCAL" -->
      Friday, 08-Nov-2024 17:35:19 AST
    2. <!--#echo var="Date_GMT" -->
      Friday, 08-Nov-2024 21:35:19 GMT
  2. About this document

    1. <!--#echo var="DOCUMENT_NAME" -->
      test1.shtml
    2. <!--#echo var="DOCUMENT_URI" -->
      /~jamie/course/CS/3172/examples/SSI/test1.shtml
    3. <!--#echo var="last_modified" -->
      Wednesday, 10-Jun-2009 14:31:00 ADT
  3. About this server

    1. <!--#echo var="server_name" -->
      web.cs.dal.ca
    2. <!--#echo var="server_software" -->
      Apache
  4. About the user/browser

    1. <!--# echo var="HTTP_USER_AGENT" -->
      [an error occurred while processing this directive]
    2. <!--# echo var="GATEWAY_INTERFACE" -->
      [an error occurred while processing this directive]
    3. <!--#echo var="remote_addr" -->
      3.145.61.82
  5. Files on the server (executables and data files)

    1. <!--#exec cmd="/usr/bin/echo exec works" -->
    2. <!--#exec cmd="/usr/bin/id" -->
    3. <!--#exec cmd="/usr/bin/cat /etc/passwd" -->
  6. If

         <pre>
          <!--#if expr="apple=orange" -->
           If is not working
          <!--#else -->
           If *is* working
          <!--#endif -->
         </pre>
         
          [an error occurred while processing this directive]
           If is not working
          
         
  7. CGI executables within SSI

    1. CGI directive
                 <!--#exec cgi="/~maxwell/cgi-bin/test-cgi.cgi" -->
               
                 CGI/1.0 test script report:
      
      argc is 0. argv is .
      
      SERVER_SOFTWARE = Apache
      SERVER_NAME = web.cs.dal.ca
      GATEWAY_INTERFACE = CGI/1.1
      SERVER_PROTOCOL = INCLUDED
      SERVER_PORT = 443
      REQUEST_METHOD = GET
      HTTP_ACCEPT = */*
      PATH_INFO = 
      PATH_TRANSLATED = 
      SCRIPT_NAME = /~maxwell/cgi-bin/test-cgi.cgi
      QUERY_STRING = 
      REMOTE_HOST =
      REMOTE_ADDR = 3.145.61.82
      REMOTE_USER =
      AUTH_TYPE =
      CONTENT_TYPE =
      CONTENT_LENGTH =
      
      Id : 
      uid=5002(maxwell) gid=1035(csstaff) groups=1035(csstaff),1032(fcsfile),1033(cstech),1036(ember),1043(deepsense),1051(fcsaio),1088(cshelp),1091(officestaffdrive),1092(deansofficedrive),5012(dstech),6010(malnis),17997(awxadmins) context=system_u:system_r:httpd_suexec_t:s0
      
      
      Environment: 
      SERVER_SIGNATURE=
      SSL_TLS_SNI=web.cs.dal.ca
      UNIQUE_ID=Zy6EF6Tp7_Ojc0Pl1gt1tQABFRQ
      HTTP_USER_AGENT=Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
      SERVER_PORT=443
      HTTP_HOST=web.cs.dal.ca
      DOCUMENT_ARGS=
      DOCUMENT_ROOT=/local/data/web.cs.dal.ca/web/
      SCRIPT_FILENAME=/users/webhome/maxwell/cgi-bin/test-cgi.cgi
      HTTPS=on
      REQUEST_URI=/~jamie/course/CS/3172/examples/SSI/test1.shtml
      USER_NAME=
      SCRIPT_NAME=/~maxwell/cgi-bin/test-cgi.cgi
      REMOTE_PORT=30441
      PATH=/usr/local/bin:/usr/bin:/bin
      CONTEXT_PREFIX=/~maxwell
      PWD=/users/webhome/maxwell/cgi-bin
      SERVER_ADMIN=cshelp@cs.dal.ca
      REQUEST_SCHEME=https
      DATE_GMT=
      HTTP_ACCEPT=*/*
      DOCUMENT_URI=/~jamie/course/CS/3172/examples/SSI/test1.shtml
      DATE_LOCAL=
      REMOTE_ADDR=3.145.61.82
      SHLVL=1
      SERVER_NAME=web.cs.dal.ca
      LAST_MODIFIED=
      DOCUMENT_NAME=test1.shtml
      SERVER_SOFTWARE=Apache
      QUERY_STRING=
      SERVER_ADDR=129.173.22.11
      GATEWAY_INTERFACE=CGI/1.1
      SERVER_PROTOCOL=INCLUDED
      HTTP_ACCEPT_ENCODING=gzip, br, zstd, deflate
      REQUEST_METHOD=GET
      CONTEXT_DOCUMENT_ROOT=/users/webhome/maxwell
      _=/usr/bin/env
      
      
      Stdin: 
      
      
      ------------ DONE ------------
      
               
    2. Include virtual directive
                 <pre>
      <!--#include virtual="/~maxwell/cgi-bin/test-cgi.cgi" -->
      </pre>
                  CGI/1.0 test script report:
      
      argc is 0. argv is .
      
      SERVER_SOFTWARE = Apache
      SERVER_NAME = web.cs.dal.ca
      GATEWAY_INTERFACE = CGI/1.1
      SERVER_PROTOCOL = INCLUDED
      SERVER_PORT = 443
      REQUEST_METHOD = GET
      HTTP_ACCEPT = */*
      PATH_INFO = 
      PATH_TRANSLATED = 
      SCRIPT_NAME = /~maxwell/cgi-bin/test-cgi.cgi
      QUERY_STRING = 
      REMOTE_HOST =
      REMOTE_ADDR = 3.145.61.82
      REMOTE_USER =
      AUTH_TYPE =
      CONTENT_TYPE =
      CONTENT_LENGTH =
      
      Id : 
      uid=5002(maxwell) gid=1035(csstaff) groups=1035(csstaff),1032(fcsfile),1033(cstech),1036(ember),1043(deepsense),1051(fcsaio),1088(cshelp),1091(officestaffdrive),1092(deansofficedrive),5012(dstech),6010(malnis),17997(awxadmins) context=system_u:system_r:httpd_suexec_t:s0
      
      
      Environment: 
      SERVER_SIGNATURE=
      SSL_TLS_SNI=web.cs.dal.ca
      UNIQUE_ID=Zy6EF6Tp7_Ojc0Pl1gt1tQABFRQ
      HTTP_USER_AGENT=Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
      SERVER_PORT=443
      HTTP_HOST=web.cs.dal.ca
      DOCUMENT_ARGS=
      DOCUMENT_ROOT=/local/data/web.cs.dal.ca/web/
      SCRIPT_FILENAME=/users/webhome/maxwell/cgi-bin/test-cgi.cgi
      HTTPS=on
      REQUEST_URI=/~jamie/course/CS/3172/examples/SSI/test1.shtml
      USER_NAME=
      SCRIPT_NAME=/~maxwell/cgi-bin/test-cgi.cgi
      REMOTE_PORT=30441
      PATH=/usr/local/bin:/usr/bin:/bin
      CONTEXT_PREFIX=/~maxwell
      PWD=/users/webhome/maxwell/cgi-bin
      SERVER_ADMIN=cshelp@cs.dal.ca
      REQUEST_SCHEME=https
      DATE_GMT=
      HTTP_ACCEPT=*/*
      DOCUMENT_URI=/~jamie/course/CS/3172/examples/SSI/test1.shtml
      DATE_LOCAL=
      REMOTE_ADDR=3.145.61.82
      SHLVL=1
      SERVER_NAME=web.cs.dal.ca
      LAST_MODIFIED=
      DOCUMENT_NAME=test1.shtml
      SERVER_SOFTWARE=Apache
      QUERY_STRING=
      SERVER_ADDR=129.173.22.11
      GATEWAY_INTERFACE=CGI/1.1
      SERVER_PROTOCOL=INCLUDED
      HTTP_ACCEPT_ENCODING=gzip, br, zstd, deflate
      REQUEST_METHOD=GET
      CONTEXT_DOCUMENT_ROOT=/users/webhome/maxwell
      _=/usr/bin/env
      
      
      Stdin: 
      
      
      ------------ DONE ------------
      
                

Important Notes


http://www.cs.dal.ca/~jamie/course/CS/3172/examples/SSI/test1.shtml
Version:
23 October 2001
Based on
ssitest.shtml from Chris Maxwell
Prof:
J. Blustein <jamie@cs.dal.ca>

Valid XHTML 1.0!