Show
Ignore:
Timestamp:
31.05.2011 23:08:12 (8 years ago)
Author:
davidb
Message:

Two new macros set, _remoteAddr_ and _remoteHost_ (if reverse lookup is know). These macros reflect the comparable environment variables that a CGI environment set

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/receptionist.cpp

    r23365 r24106  
    14491449  disp.setmacro ("httpprefix", displayclass::defaultpackage, configinfo.httpprefix); 
    14501450 
     1451  // This perhaps should be done with gsdl_getenv() which takes the 
     1452  // 'fcgienv' parameter (for fast-cgi), however if changed to this, this 
     1453  // additional parameter would need to be passed into here (not sure how 
     1454  // that would effect any virtual inheritence going on), or else moved 
     1455  // higher up the calling to chain to, e.g., produce_cgi_page() 
     1456 
     1457  char* remote_addr = getenv("REMOTE_ADDR"); 
     1458 
     1459  if (remote_addr != NULL) { 
     1460     text_t remote_addr_t(remote_addr); 
     1461     disp.setmacro ("remoteAddr", displayclass::defaultpackage, remote_addr_t); 
     1462  } 
     1463 
     1464  char* remote_host = getenv("REMOTE_HOST"); 
     1465  if (remote_host != NULL) { 
     1466     text_t remote_host_t(remote_host); 
     1467     disp.setmacro ("remoteHost", displayclass::defaultpackage, remote_host_t); 
     1468  } 
     1469  else { 
     1470     // setting this to "unknown" is easier to deal with in format/macro 
     1471     // statements, rather than testing for _remoteHost_ 
     1472     disp.setmacro ("remoteHost", displayclass::defaultpackage, "unknown"); 
     1473  } 
     1474 
     1475 
    14511476  text_t compressedoptions = get_compressed_arg(args, logout); 
    14521477  disp.setmacro ("compressedoptions", displayclass::defaultpackage, dm_safe(compressedoptions));