mturk       2004/08/03 10:41:00

  Modified:    ajp/proxy mod_proxy.c
  Log:
  Add ProxyStickySession directive.
  
  Revision  Changes    Path
  1.8       +43 -0     jakarta-tomcat-connectors/ajp/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/proxy/mod_proxy.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mod_proxy.c       3 Aug 2004 17:18:47 -0000       1.7
  +++ mod_proxy.c       3 Aug 2004 17:41:00 -0000       1.8
  @@ -1151,6 +1151,47 @@
       return NULL;
   }
   
  +static const char *
  +    set_sticky_session(cmd_parms *cmd, void *dummy, const char *f, const char *r)
  +{
  +    server_rec *s = cmd->server;
  +    proxy_server_conf *conf =
  +    ap_get_module_config(s->module_config, &proxy_module);
  +    struct proxy_balancer *balancer, *balancers;
  +    int i;
  +    const char *name, *sticky;
  +
  +    if (r != NULL && cmd->path == NULL ) {
  +        name = f;
  +        sticky = r;
  +    } else if (r == NULL && cmd->path != NULL) {
  +        name = cmd->path;
  +        sticky = f;
  +    } else {
  +        if (r == NULL)
  +            return "ProxyStickySession needs a path when not defined in a location";
  +        else 
  +            return "ProxyStickySession can not have a path when defined in a 
location";
  +    }
  +    /* Try to find the balancer */
  +    balancers = (struct proxy_balancer *)conf->balancers->elts;
  +    for (i = 0; i < conf->balancers->nelts; i++) {
  +        if (!strcmp(name, balancers[i].name)) {
  +            balancer = &balancers[i];
  +            break;
  +        }
  +    }
  +
  +    if (!balancer)
  +        return apr_pstrcat(cmd->temp_pool, "ProxyStickySession: can not find a load 
balancer '",
  +                           name, "'", NULL);
  +    if (!strcasecmp(sticky, "nofailover"))
  +        balancer->sticky_force = 1;   
  +    else
  +        balancer->sticky = sticky;
  +    return NULL;
  +}
  +
   static void ap_add_per_proxy_conf(server_rec *s, ap_conf_vector_t *dir_config)
   {
       proxy_server_conf *sconf = ap_get_module_config(s->module_config,
  @@ -1293,6 +1334,8 @@
        "How to handle bad header line in response: IsError | Ignore | StartBody"),
       AP_INIT_ITERATE("BalancerMember", add_member, NULL, RSRC_CONF|ACCESS_CONF,
        "A balancer name and scheme with list of params"), 
  +    AP_INIT_TAKE12("ProxyStickySession", set_sticky_session, NULL, 
RSRC_CONF|ACCESS_CONF,
  +     "A balancer and sticky session name"),
       {NULL}
   };
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to