You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2002/11/12 20:59:16 UTC

cvs commit: apache-1.3/src/modules/standard mod_setenvif.c

coar        2002/11/12 11:59:16

  Modified:    src      CHANGES
               src/modules/standard mod_setenvif.c
  Log:
  	Add a SERVER_ADDR keyword to match the CGI environment variable,
  	to allow conditional setting according to the IP address on
  	which the server received the request.
  
  Revision  Changes    Path
  1.1860    +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1859
  retrieving revision 1.1860
  diff -u -u -r1.1859 -r1.1860
  --- CHANGES	3 Oct 2002 19:58:08 -0000	1.1859
  +++ CHANGES	12 Nov 2002 19:59:15 -0000	1.1860
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.28
   
  +  *) mod_setenvif: Add SERVER_ADDR special keyword to allow
  +     envariable setting according to the server IP address
  +     which received the request.  [Ken Coar]
  +
     *) PORT: Enable SINGLE_LISTEN_UNSERIALIZED_ACCEPT for AIX 4.3.2
        and above.  Update AIX configure logic to allow higher AIX 
        release numbers without having to change Apache.
  
  
  
  1.36      +11 -1     apache-1.3/src/modules/standard/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_setenvif.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -u -r1.35 -r1.36
  --- mod_setenvif.c	13 Mar 2002 21:05:34 -0000	1.35
  +++ mod_setenvif.c	12 Nov 2002 19:59:16 -0000	1.36
  @@ -91,6 +91,8 @@
    *
    * Special values for 'name' are:
    *
  + *   server_addr       IP address of interface on which request arrived
  + *                     (analogous to SERVER_ADDR set in ap_add_common_vars())
    *   remote_host        Remote host name (if available)
    *   remote_addr        Remote IP address
    *   remote_user        Remote authenticated user (if any)
  @@ -127,7 +129,8 @@
       SPECIAL_REMOTE_USER,
       SPECIAL_REQUEST_URI,
       SPECIAL_REQUEST_METHOD,
  -    SPECIAL_REQUEST_PROTOCOL
  +    SPECIAL_REQUEST_PROTOCOL,
  +    SPECIAL_SERVER_ADDR
   };
   typedef struct {
       char *name;                 /* header name */
  @@ -279,6 +282,9 @@
   	else if (!strcasecmp(fname, "request_protocol")) {
   	    new->special_type = SPECIAL_REQUEST_PROTOCOL;
   	}
  +        else if (!strcasecmp(fname, "server_addr")) {
  +            new->special_type = SPECIAL_SERVER_ADDR;
  +        }
   	else {
   	    new->special_type = SPECIAL_NOT;
   	}
  @@ -397,6 +403,10 @@
   	    case SPECIAL_REMOTE_ADDR:
   		val = r->connection->remote_ip;
   		break;
  +                break;
  +            case SPECIAL_SERVER_ADDR:
  +                val = r->connection->local_ip;
  +                break;
   	    case SPECIAL_REMOTE_HOST:
   		val =  ap_get_remote_host(r->connection, r->per_dir_config,
   					  REMOTE_NAME);