Commit 2c1648d0 authored by Andre Malo's avatar Andre Malo
Browse files

Extend the SetEnvIf directive to capture subexpressions of the

matched value.

Reviewed by: Paul J. Reder, Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@104674 13f79535-47bb-0310-9956-ffa450edef68
parent 397574f1
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
Changes with Apache 2.0.51
  *) Extend the SetEnvIf directive to capture subexpressions of the
     matched value.  [André Malo]
  *) Recursive Include directives no longer crash. The server stops
     including configuration files after a certain nesting level (128
     as distributed). This is configurable at compile time using the
+1 −6
Changes for STATUS: 1 added line, 6 removed lines.
Original line number Diff line number Diff line
APACHE 2.0 STATUS:                                              -*-text-*-
Last modified at [$Date: 2004/08/15 22:42:13 $]
Last modified at [$Date: 2004/08/15 23:33:27 $]

Release:

@@ -290,11 +290,6 @@ PATCHES TO BACKPORT FROM 2.1
      -1: brianp (we need a more robust solution than what's in 2.1 right now),
          jerenkrantz (should be fixed, but I don't have time to do this)

    * Extend the SetEnvIf directive to capture subexpressions of the
      matched value.
        modules/metadata/mod_setenvif.c r1.42, r1.43
      +1: nd, rederpj, trawick

    * Allow mod_dav to do weak entity comparison functions.
      modules/dav/main/util.c: r1.45
      [ This one is under review.  Don't merge.  ]
+16 −4
Changes for modules/metadata/mod_setenvif.c: 16 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -319,8 +319,7 @@ static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
        }
        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);
@@ -458,6 +457,7 @@ static int match_headers(request_rec *r)
    apr_size_t val_len = 0;
    int i, j;
    char *last_name;
    regmatch_t regm[AP_MAX_REG_MATCH];

    if (!ap_get_module_config(r->request_config, &setenvif_module)) {
        ap_set_module_config(r->request_config, &setenvif_module,
@@ -545,7 +545,8 @@ static int match_headers(request_rec *r)
        }

        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, AP_MAX_REG_MATCH, regm,
                                        0))) {
            const apr_array_header_t *arr = apr_table_elts(b->features);
            elts = (const apr_table_entry_t *) arr->elts;

@@ -554,7 +555,18 @@ static int match_headers(request_rec *r)
                    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,
                                                    AP_MAX_REG_MATCH, 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);
                    }
                }
            }
        }