httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/metadata mod_setenvif.c
Date Fri, 14 Feb 2003 20:04:41 GMT
nd          2003/02/14 12:04:41

  Modified:    .        CHANGES
               modules/metadata mod_setenvif.c
  Log:
  Extend the SetEnvIf directive to capture subexpressions of the
  matched value.
  
  Revision  Changes    Path
  1.1066    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1065
  retrieving revision 1.1066
  diff -u -r1.1065 -r1.1066
  --- CHANGES	14 Feb 2003 16:17:07 -0000	1.1065
  +++ CHANGES	14 Feb 2003 20:04:36 -0000	1.1066
  @@ -2,6 +2,9 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Extend the SetEnvIf directive to capture subexpressions of the
  +     matched value.  [André Malo]
  +
     *) Updated mod_ldap and mod_auth_ldap to support the Novell LDAP SDK 
        and standardized the LDAP SSL support across the various LDAP SDKs.  
        Isolated the SSL functionality to mod_ldap rather than speading it 
  
  
  
  1.42      +16 -4     httpd-2.0/modules/metadata/mod_setenvif.c
  
  Index: mod_setenvif.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_setenvif.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- mod_setenvif.c	12 Feb 2003 17:58:09 -0000	1.41
  +++ mod_setenvif.c	14 Feb 2003 20:04:39 -0000	1.42
  @@ -351,8 +351,7 @@
           }
           else {
               new->preg = ap_pregcomp(cmd->pool, regex,
  -                                    (REG_EXTENDED | REG_NOSUB
  -                                     | (icase ? REG_ICASE : 0)));
  +                                    (REG_EXTENDED | (icase ? REG_ICASE : 0)));
               if (new->preg == NULL) {
                   return apr_pstrcat(cmd->pool, cmd->cmd->name,
                                      " regex could not be compiled.", NULL);
  @@ -490,6 +489,7 @@
       apr_size_t val_len = 0;
       int i, j;
       char *last_name;
  +    regmatch_t regm[10];
   
       if (!ap_get_module_config(r->request_config, &setenvif_module)) {
           ap_set_module_config(r->request_config, &setenvif_module,
  @@ -577,7 +577,8 @@
           }
   
           if ((b->pattern && apr_strmatch(b->pattern, val, val_len)) ||
  -            (!b->pattern && !ap_regexec(b->preg, val, 0, NULL, 0))) {
  +            (!b->pattern && !ap_regexec(b->preg, val, b->preg->re_nsub
+ 1,
  +                                        regm, 0))) {
               const apr_array_header_t *arr = apr_table_elts(b->features);
               elts = (const apr_table_entry_t *) arr->elts;
   
  @@ -586,7 +587,18 @@
                       apr_table_unset(r->subprocess_env, elts[j].key);
                   }
                   else {
  -                    apr_table_setn(r->subprocess_env, elts[j].key, elts[j].val);
  +                    if (!b->pattern) {
  +                        char *replaced = ap_pregsub(r->pool, elts[j].val, val,
  +                                                    b->preg->re_nsub + 1, regm);
  +                        if (replaced) {
  +                            apr_table_setn(r->subprocess_env, elts[j].key,
  +                                           replaced);
  +                        }
  +                    }
  +                    else {
  +                        apr_table_setn(r->subprocess_env, elts[j].key,
  +                                       elts[j].val);
  +                    }
                   }
               }
           }
  
  
  

Mime
View raw message