1 diff -x {arch} -x .arch-ids -urN orig/apache2/Makefile.in mod/apache2/Makefile.in
2 --- orig/apache2/Makefile.in 2004-03-07 03:18:24.000000000 -0500
3 +++ mod/apache2/Makefile.in 2004-03-07 01:18:10.000000000 -0500
5 @cp -p $(srcdir)/modules/http/mod_core.h $(DESTDIR)$(includedir)
6 @cp -p $(srcdir)/modules/proxy/mod_proxy.h $(DESTDIR)$(includedir)
7 @cp -p $(srcdir)/modules/ssl/*.h $(DESTDIR)$(includedir)
8 - @cp -p $(srcdir)/srclib/pcre/pcre*.h $(DESTDIR)$(includedir)
9 + @if test "$(AP_EXTERN_PCRE)" != "0"; then \
10 + cp -p $(srcdir)/srclib/pcre/pcre*.h $(DESTDIR)$(includedir); \
12 @cp -p $(srcdir)/os/$(OS_DIR)/*.h $(DESTDIR)$(includedir)
13 @chmod 644 $(DESTDIR)$(includedir)/*.h
15 diff -x {arch} -x .arch-ids -urN orig/apache2/acinclude.m4 mod/apache2/acinclude.m4
16 --- orig/apache2/acinclude.m4 2004-03-07 03:18:24.000000000 -0500
17 +++ mod/apache2/acinclude.m4 2004-03-07 01:18:09.000000000 -0500
22 +dnl APACHE_CHECK_PCRE
23 +dnl Apache includes it's own version of PCRE; however, if PCRE exists
24 +dnl on the build system, we link against that instead of building
25 +dnl Apache's own PCRE.
27 +AC_DEFUN(APACHE_CHECK_PCRE, [
28 + AC_MSG_CHECKING(for external PCRE library)
33 + AC_ARG_WITH([pcre], AS_HELP_STRING([--with-external-pcre],
34 + [use external libpcre (versus apache-supplied pcre)]), [
35 + if test "x$withval" = "xno"; then
37 + elif test "x$withval" != "xyes" -a "x$withval" != "x"; then
38 + ap_pcre_base="$withval"
42 + if test "$ap_test_pcre" != "0"; then
43 + ap_pcre_conf="pcre-config"
44 + if test -f "$ap_pcre_base"; then
45 + ap_pcre_conf="$ap_pcre_base";
46 + elif test -f "$ap_pcre_base/pcre-config"; then
47 + ap_pcre_conf="$ap_pcre_base/pcre-config";
48 + elif test -f "$ap_pcre_base/bin/pcre-config"; then
49 + ap_pcre_conf="$ap_pcre_base/bin/pcre-config";
52 + ap_save_CFLAGS="$CFLAGS"
53 + ap_save_LIBS="$LIBS"
54 + CFLAGS="$CFLAGS `$ap_pcre_conf --cflags 2>/dev/null`"
55 + LIBS="$LIBS `$ap_pcre_conf --libs 2>/dev/null`"
56 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pcre.h>]],
57 + [[char *foo = pcre_version();]])], [
60 + CFLAGS="$ap_save_CFLAGS"
61 + LIBS="$ap_save_LIBS"
65 + if test "$AP_EXTERN_PCRE" = "1"; then
70 + AC_SUBST(AP_EXTERN_PCRE)
74 dnl APACHE_EXPORT_ARGUMENTS
75 dnl Export (via APACHE_SUBST) the various path-related variables that
76 dnl apache will use while generating scripts like autoconf and apxs and
77 diff -x {arch} -x .arch-ids -urN orig/apache2/configure.in mod/apache2/configure.in
78 --- orig/apache2/configure.in 2004-03-07 03:18:27.000000000 -0500
79 +++ mod/apache2/configure.in 2004-03-07 01:18:08.000000000 -0500
84 -echo $ac_n "${nl}Configuring PCRE regular expression library ...${nl}"
86 -APR_SUBDIR_CONFIG(srclib/pcre,
87 - [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir])
89 +if test "$AP_EXTERN_PCRE" = "0"; then
90 + echo $ac_n "${nl}Configuring PCRE regular expression library ...${nl}"
91 + APR_SUBDIR_CONFIG(srclib/pcre,
92 + [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir])
93 + AP_BUILD_SRCLIB_DIRS="$AP_BUILD_SRCLIB_DIRS pcre"
94 + AP_CLEAN_SRCLIB_DIRS="pcre $AP_CLEAN_SRCLIB_DIRS"
97 echo $ac_n "${nl}Configuring Apache httpd ...${nl}"
100 APACHE_HELP_STRING(--with-suexec-umask,umask for suexec'd process),[
101 AC_DEFINE_UNQUOTED(AP_SUEXEC_UMASK, 0$withval, [umask for suexec'd process] ) ] )
103 -dnl AP_LIBS specifies the actual libraries. note we have some required libs.
104 -AP_LIBS="$abs_builddir/srclib/pcre/libpcre.la $AP_LIBS"
106 dnl APR should go after the other libs, so the right symbols can be picked up
107 AP_LIBS="$AP_LIBS `$apu_config --link-libtool --libs` `$apr_config --link-libtool --libs`"
108 APACHE_SUBST(AP_LIBS)
109 diff -x {arch} -x .arch-ids -urN orig/apache2/server/Makefile.in mod/apache2/server/Makefile.in
110 --- orig/apache2/server/Makefile.in 2004-03-07 03:18:46.000000000 -0500
111 +++ mod/apache2/server/Makefile.in 2004-03-07 02:52:53.000000000 -0500
113 LTLIBRARY_NAME = libmain.la
114 LTLIBRARY_SOURCES = \
116 - config.c log.c main.c vhost.c util.c \
117 + config.c log.c main.c vhost.c util.c util_pcre.c \
118 util_script.c util_md5.c util_cfgtree.c util_ebcdic.c util_time.c \
119 rfc1413.c connection.c listen.c \
120 mpm_common.c util_charset.c util_debug.c util_xml.c \
121 diff -x {arch} -x .arch-ids -urN orig/apache2/server/util.c mod/apache2/server/util.c
122 --- orig/apache2/server/util.c 2004-03-07 03:18:48.000000000 -0500
123 +++ mod/apache2/server/util.c 2004-03-07 03:03:54.000000000 -0500
126 static apr_status_t regex_cleanup(void *preg)
128 - regfree((regex_t *) preg);
129 + ap_regfree((regex_t *) preg);
135 regex_t *preg = apr_palloc(p, sizeof(regex_t));
137 - if (regcomp(preg, pattern, cflags)) {
138 + if (ap_regcomp(preg, pattern, cflags)) {
144 AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t * reg)
148 apr_pool_cleanup_kill(p, (void *) reg, regex_cleanup);
156 - * Apache stub function for the regex libraries regexec() to make sure the
157 - * whole regex(3) API is available through the Apache (exported) namespace.
158 - * This is especially important for the DSO situations of modules.
159 - * DO NOT MAKE A MACRO OUT OF THIS FUNCTION!
161 -AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string,
162 - size_t nmatch, regmatch_t pmatch[], int eflags)
164 - return regexec(preg, string, nmatch, pmatch, eflags);
167 -AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, char *errbuf,
168 - size_t errbuf_size)
170 - return regerror(errcode, preg, errbuf, errbuf_size);
174 /* This function substitutes for $0-$9, filling in regular expression
175 * submatches. Pass it the same nmatch and pmatch arguments that you
176 * passed ap_regexec(). pmatch should not be greater than the maximum number
177 diff -x {arch} -x .arch-ids -urN orig/apache2/server/util_pcre.c mod/apache2/server/util_pcre.c
178 --- orig/apache2/server/util_pcre.c 1969-12-31 19:00:00.000000000 -0500
179 +++ mod/apache2/server/util_pcre.c 2004-03-07 03:14:49.000000000 -0500
181 +/*************************************************
182 +* Perl-Compatible Regular Expressions *
183 +*************************************************/
186 +This is a library of functions to support regular expressions whose syntax
187 +and semantics are as close as possible to those of the Perl 5 language. See
188 +the file Tech.Notes for some information on the internals.
190 +This module is a wrapper that provides a POSIX API to the underlying PCRE
193 +Written by: Philip Hazel <ph10@cam.ac.uk>
195 + Copyright (c) 1997-2003 University of Cambridge
196 + Copyright (C) 2004 Andres Salomon <dilinger@voxel.net>
198 +-----------------------------------------------------------------------------
199 +Permission is granted to anyone to use this software for any purpose on any
200 +computer system, and to redistribute it freely, subject to the following
203 +1. This software is distributed in the hope that it will be useful,
204 + but WITHOUT ANY WARRANTY; without even the implied warranty of
205 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
207 +2. The origin of this software must not be misrepresented, either by
208 + explicit claim or by omission.
210 +3. Altered versions must be plainly marked as such, and must not be
211 + misrepresented as being the original software.
213 +4. If PCRE is embedded in any software that is released under the GNU
214 + General Purpose Licence (GPL), then the terms of that licence shall
215 + supersede any condition above with which it is incompatible.
216 +----------------------------------------------------------------------------
220 +#include "apr_strings.h"
221 +#include "apr_lib.h"
223 +#define APR_WANT_STDIO
224 +#define APR_WANT_STRFUNC
225 +#include "apr_want.h"
227 +#if APR_HAVE_UNISTD_H
230 +#if APR_HAVE_NETDB_H
231 +#include <netdb.h> /* for gethostbyname() */
234 +#define CORE_PRIVATE
236 +#include "ap_config.h"
237 +#include "apr_base64.h"
239 +#include "http_main.h"
240 +#include "http_log.h"
241 +#include "http_protocol.h"
242 +#include "http_config.h"
243 +#include "util_ebcdic.h"
247 +#ifndef PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
248 +#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3
251 +/* Table of texts corresponding to POSIX error codes */
253 +static const char *pstring[] = {
254 + "", /* Dummy for value 0 */
255 + "internal error", /* REG_ASSERT */
256 + "invalid repeat counts in {}", /* BADBR */
257 + "pattern error", /* BADPAT */
258 + "? * + invalid", /* BADRPT */
259 + "unbalanced {}", /* EBRACE */
260 + "unbalanced []", /* EBRACK */
261 + "collation error - not relevant", /* ECOLLATE */
262 + "bad class", /* ECTYPE */
263 + "bad escape sequence", /* EESCAPE */
264 + "empty expression", /* EMPTY */
265 + "unbalanced ()", /* EPAREN */
266 + "bad range inside []", /* ERANGE */
267 + "expression too big", /* ESIZE */
268 + "failed to get memory", /* ESPACE */
269 + "bad back reference", /* ESUBREG */
270 + "bad argument", /* INVARG */
271 + "match failed" /* NOMATCH */
277 +/*************************************************
278 +* Translate error code to string *
279 +*************************************************/
282 +ap_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
284 +const char *message, *addmessage;
285 +size_t length, addlength;
287 +message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
288 + "unknown error code" : pstring[errcode];
289 +length = strlen(message) + 1;
291 +addmessage = " at offset ";
292 +addlength = (preg != NULL && (int)preg->re_erroffset != -1)?
293 + strlen(addmessage) + 6 : 0;
295 +if (errbuf_size > 0)
297 + if (addlength > 0 && errbuf_size >= length + addlength)
298 + sprintf(errbuf, "%s%s%-6d", message, addmessage, (int)preg->re_erroffset);
301 + strncpy(errbuf, message, errbuf_size - 1);
302 + errbuf[errbuf_size-1] = 0;
306 +return length + addlength;
312 +/*************************************************
313 +* Free store held by a regex *
314 +*************************************************/
317 +ap_regfree(regex_t *preg)
319 +(pcre_free)(preg->re_pcre);
325 +/*************************************************
326 +* Compile a regular expression *
327 +*************************************************/
331 + preg points to a structure for recording the compiled expression
332 + pattern the pattern to compile
333 + cflags compilation flags
335 +Returns: 0 on success
336 + various non-zero codes on failure
340 +ap_regcomp(regex_t *preg, const char *pattern, int cflags)
342 +const char *errorptr;
346 +if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
347 +if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
349 +preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
350 +preg->re_erroffset = erroffset;
352 +if (preg->re_pcre == NULL) return 1;
354 +preg->re_nsub = pcre_info(preg->re_pcre, NULL, NULL);
361 +/*************************************************
362 +* Match a regular expression *
363 +*************************************************/
365 +/* Unfortunately, PCRE requires 3 ints of working space for each captured
366 +substring, so we have to get and release working store instead of just using
367 +the POSIX structures as was done in earlier releases when PCRE needed only 2
368 +ints. However, if the number of possible capturing brackets is small, use a
369 +block of store on the stack, to reduce the use of malloc/free. The threshold is
370 +in a macro that can be changed at configure time. */
373 +ap_regexec(regex_t *preg, const char *string, size_t nmatch,
374 + regmatch_t pmatch[], int eflags)
378 +int *ovector = NULL;
379 +int small_ovector[PCRE_CONFIG_POSIX_MALLOC_THRESHOLD * 3];
380 +int allocated_ovector = 0;
382 +if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
383 +if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
385 +((regex_t *)preg)->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
389 + if (nmatch <= PCRE_CONFIG_POSIX_MALLOC_THRESHOLD)
391 + ovector = &(small_ovector[0]);
395 + ovector = (int *)malloc(sizeof(int) * nmatch * 3);
396 + if (ovector == NULL) return REG_ESPACE;
397 + allocated_ovector = 1;
401 +rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options,
402 + ovector, nmatch * 3);
404 +if (rc == 0) rc = nmatch; /* All captured slots were filled in */
409 + for (i = 0; i < (size_t)rc; i++)
411 + pmatch[i].rm_so = ovector[i*2];
412 + pmatch[i].rm_eo = ovector[i*2+1];
414 + if (allocated_ovector) free(ovector);
415 + for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
421 + if (allocated_ovector) free(ovector);
424 + case PCRE_ERROR_NOMATCH: return REG_NOMATCH;
425 + case PCRE_ERROR_NULL: return REG_INVARG;
426 + case PCRE_ERROR_BADOPTION: return REG_INVARG;
427 + case PCRE_ERROR_BADMAGIC: return REG_INVARG;
428 + case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT;
429 + case PCRE_ERROR_NOMEMORY: return REG_ESPACE;
430 + default: return REG_ASSERT;
435 diff -x {arch} -x .arch-ids -urN orig/apache2/srclib/Makefile.in mod/apache2/srclib/Makefile.in
436 --- orig/apache2/srclib/Makefile.in 2004-03-07 03:18:49.000000000 -0500
437 +++ mod/apache2/srclib/Makefile.in 2004-03-07 01:18:07.000000000 -0500
442 BUILD_SUBDIRS = $(AP_BUILD_SRCLIB_DIRS)
443 CLEAN_SUBDIRS = $(AP_CLEAN_SRCLIB_DIRS)