Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 6689 invoked from network); 15 Jul 2010 19:20:30 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Jul 2010 19:20:30 -0000 Received: (qmail 9671 invoked by uid 500); 15 Jul 2010 19:20:29 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 9550 invoked by uid 500); 15 Jul 2010 19:20:28 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 9542 invoked by uid 99); 15 Jul 2010 19:20:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jul 2010 19:20:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 15 Jul 2010 19:20:25 +0000 Received: (qmail 6623 invoked by uid 2161); 15 Jul 2010 19:20:04 -0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by euler.heimnetz.de (Postfix) with ESMTP id 879CC24044 for ; Thu, 15 Jul 2010 21:20:54 +0200 (CEST) Message-ID: <4C3F5F96.6090905@apache.org> Date: Thu, 15 Jul 2010 21:20:54 +0200 From: Ruediger Pluem User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.24) Gecko/20100301 SeaMonkey/1.1.19 MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: svn commit: r894036 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_headers.xml modules/metadata/mod_headers.c References: <20091227000512.D2ED123888D1@eris.apache.org> In-Reply-To: <20091227000512.D2ED123888D1@eris.apache.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 12/27/2009 01:05 AM, niq@apache.org wrote: > Author: niq > Date: Sun Dec 27 00:05:12 2009 > New Revision: 894036 > > URL: http://svn.apache.org/viewvc?rev=894036&view=rev > Log: > mod_headers: Enable multi-match-and-replace edit option > PR 47066 > > Modified: > httpd/httpd/trunk/CHANGES > httpd/httpd/trunk/docs/manual/mod/mod_headers.xml > httpd/httpd/trunk/modules/metadata/mod_headers.c > > Modified: httpd/httpd/trunk/modules/metadata/mod_headers.c > URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_headers.c?rev=894036&r1=894035&r2=894036&view=diff > ============================================================================== > --- httpd/httpd/trunk/modules/metadata/mod_headers.c (original) > +++ httpd/httpd/trunk/modules/metadata/mod_headers.c Sun Dec 27 00:05:12 2009 > @@ -566,6 +570,7 @@ > unsigned int nmatch = 10; > ap_regmatch_t pmatch[10]; > const char *subs; > + const char *remainder; > char *ret; > int diffsz; > if (ap_regexec(hdr->regex, value, nmatch, pmatch, 0)) { > @@ -574,6 +579,13 @@ > } > subs = ap_pregsub(pool, hdr->subs, value, nmatch, pmatch); > diffsz = strlen(subs) - (pmatch[0].rm_eo - pmatch[0].rm_so); > + if (hdr->action == hdr_edit) { > + remainder = value + pmatch[0].rm_eo; > + } > + else { /* recurse to edit multiple matches if applicable */ > + remainder = process_regexp(hdr, value + pmatch[0].rm_eo, pool); > + diffsz += strlen(remainder) - strlen(value + pmatch[0].rm_eo); > + } > ret = apr_palloc(pool, strlen(value) + 1 + diffsz); > memcpy(ret, value, pmatch[0].rm_so); > strcpy(ret + pmatch[0].rm_so, subs); > @@ -722,6 +734,7 @@ > echo_header, (void *) &v, r->headers_in, NULL); > break; > case hdr_edit: > + case hdr_edit_r: > if (!strcasecmp(hdr->header, "Content-Type") && r->content_type) { > ap_set_content_type(r, process_regexp(hdr, r->content_type, > r->pool)); > > Don't we need the following patch in addition? Index: mod_headers.c =================================================================== --- mod_headers.c (Revision 964531) +++ mod_headers.c (Arbeitskopie) @@ -592,7 +592,7 @@ ret = apr_palloc(pool, strlen(value) + 1 + diffsz); memcpy(ret, value, pmatch[0].rm_so); strcpy(ret + pmatch[0].rm_so, subs); - strcat(ret, value + pmatch[0].rm_eo); + strcat(ret, remainder); return ret; } Regards RĂ¼diger