util_current_location

one of the documented procedures in this installation of the ACS
Usage:
util_current_location {}
What it does:
Like ns_conn location - Returns the location string of the current request in the form protocol://hostname[:port] but it looks at the Host header, that is, takes into account the host name the client used although it may be different from the host name from the server configuration file. If the Host header is missing or empty util_current_location falls back to ns_conn location.
Defined in: /web/philip/packages/acs-core/utilities-procs.tcl

Source code:

arg_parser_for_util_current_location $args

   set host_from_header [ns_set iget [ns_conn headers] Host]
   # host_from_header now hopefully contains hostname[:port]
   set location_from_config_file [ns_conn location]
   if {[empty_string_p $host_from_header]} {
      # Hmm, there is no Host header.  This must be
      # an old browser such as MSIE 3.  All we can do is:
      return $location_from_config_file
   } else {
      # Replace the hostname[:port] part of $location_from_config_file with $host_from_header:
      regsub -nocase {(^[a-z]+://).*}  $location_from_config_file \\1$host_from_header location_from_host_header
      return $location_from_host_header
   }


philg@mit.edu