if(variables == null) variables = new Hashtable(5) ;
// Format variables:
safePut(variables,"sizefmt","abbrev") ; // Abbreviated file sizes
safePut(variables,"datefmt","%c") ; // Locale's format
ArrayDictionary ssiVars = new ArrayDictionary(22) ;
// CGI/SSI variables:
// This weird nesting of dictionaries is so that the set of
// variables that is exposed via the echo comand is clearly
// delimited.
safePut(ssiVars,"DOCUMENT_NAME",
ssiframe.getFileResource().getFilename()) ;
safePut(ssiVars,"DOCUMENT_URI",
request.getURL().toString()) ;
safePut(ssiVars,"QUERY_STRING_UNESCAPED",
unescape(request.getQueryString())) ;
safePut(ssiVars,"SERVER_SOFTWARE",
ssiframe.getFileResource().getServer().getSoftware()) ;
safePut(ssiVars,"SERVER_NAME",
"jigsaw") ;
safePut(ssiVars,"GATEWAY_INTERFACE",
"org.w3c.jigsaw.ssi.SSIFrame") ; // (?)
safePut(ssiVars,"SERVER_PROTOCOL",
request.getVersion()) ;
safePut(ssiVars,"SERVER_PORT",
String.valueOf(ssiframe.getFileResource()
.getServer()
.getLocalPort())) ;
safePut(ssiVars,"REQUEST_METHOD",
request.getMethod()) ;
safePut(ssiVars,"PATH_INFO",
"") ;
safePut(ssiVars,"PATH_TRANSLATED",
"") ;
safePut(ssiVars,"SCRIPT_NAME",
"org.w3c.jigsaw.ssi.SSIFrame") ; // (?)
String queryString = request.getQueryString() ;
safePut(ssiVars,"QUERY_STRING",
queryString) ;
java.net.InetAddress addr =
request.getClient().getInetAddress() ;
safePut(ssiVars,"REMOTE_HOST",
addr.getHostName()) ;
// This should be simpler (why not addr.getIPAddress() ???)
String s = addr.toString() ;
byte[] ip = addr.getAddress() ;
int idx = s.indexOf('/') ;
safePut(ssiVars,"REMOTE_ADDR",
(idx == -1) ? s : s.substring(idx+1)) ;
safePut(ssiVars,"REMOTE_USER",
request.getState(org.w3c.jigsaw.auth.AuthFilter.STATE_AUTHUSER)) ;
safePut(ssiVars,"AUTH_TYPE",
request.getState(org.w3c.jigsaw.auth.AuthFilter.STATE_AUTHTYPE)) ;
safePut(ssiVars,"REMOTE_IDENT",
"") ;
safePut(ssiVars,"CONTENT_TYPE",
request.getContentType()) ;
int cl = request.getContentLength() ;
if(cl != -1)
ssiVars.put("CONTENT_LENGTH",
String.valueOf(cl)) ;
HeaderValue hval = request.getHeaderValue(Request.H_ACCEPT) ;
if(hval != null)
ssiVars.put("HTTP_ACCEPT",hval.toExternalForm()) ;
safePut(ssiVars,"HTTP_USER_AGENT",
request.getUserAgent()) ;
safePut(ssiVars,"X_LAST_MODIFIED",