httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <torsten.foert...@gmx.net>
Subject Re: [users@httpd] Word boundaries in regexps (Apache bug?)
Date Tue, 15 Sep 2009 16:28:31 GMT
On Tue 15 Sep 2009, Nick Kew wrote:
> > /\\bcity\\b/ works on my localhost (Debian Linux with Apache
> > 2.2.13-1),
>
> Good.  Mystery solved (though I have to confess I'm a little
> surprised you need that in the context).

Here is the piece of code that (I believe) eats the backslashes (mod_include.c:
get_ptoken()). token->value is the start of the string, p the end. shift is
the number of unescaped backslashes found in the string.

        apr_size_t len = p - token->value - shift;
        char *c = apr_palloc(ctx->dpool, len + 1);

        p = token->value;
        token->value = c;

        while (shift--) {
            const char *e = ap_strchr_c(p, '\\');  /* move e to the next backslash */

            memcpy(c, p, e-p);                     /* copy up to the backslash excluding it
*/
            c   += e-p;                            /* now c points to the end of the destination
string */
            *c++ = *++e;                           /* copy there the char that comes *after*
the '\' and forget about the '\' */
            len -= e-p;
            p    = e+1;
        }

        if (len) {
            memcpy(c, p, len);
        }
        c[len] = '\0';

Torsten

-- 
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message