1
diff -urN build-tree.orig/apache2/Makefile.in build-tree/apache2/Makefile.in
2
--- build-tree.orig/apache2/Makefile.in 2004-11-24 12:31:09.000000000 -0700
3
+++ build-tree/apache2/Makefile.in 2005-02-09 11:27:22.000000000 -0700
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
@cp -p $(srcdir)/os/$(OS_DIR)/*.h $(DESTDIR)$(includedir)
10
@chmod 644 $(DESTDIR)$(includedir)/*.h
12
diff -urN build-tree.orig/apache2/configure.in build-tree/apache2/configure.in
13
--- build-tree.orig/apache2/configure.in 2004-11-24 12:31:09.000000000 -0700
14
+++ build-tree/apache2/configure.in 2005-02-09 11:25:13.000000000 -0700
17
dnl AP_LIBS specifies the actual libraries. note we have some required libs.
18
AP_LIBS="$abs_builddir/srclib/pcre/libpcre.la $AP_LIBS"
19
+APR_ADDTO(CPPFLAGS, [-I$abs_builddir/srclib/pcre])
21
dnl APR should go after the other libs, so the right symbols can be picked up
22
AP_LIBS="$AP_LIBS `$apu_config --link-libtool --libs` `$apr_config --link-libtool --libs`"
23
diff -urN build-tree.orig/apache2/include/ap_regex.h build-tree/apache2/include/ap_regex.h
24
--- build-tree.orig/apache2/include/ap_regex.h 1969-12-31 17:00:00.000000000 -0700
25
+++ build-tree/apache2/include/ap_regex.h 2005-02-09 11:28:02.000000000 -0700
27
+/*************************************************
28
+* Perl-Compatible Regular Expressions *
29
+*************************************************/
31
+/* Copyright (c) 1997-2000 University of Cambridge */
34
+ * @file include/pcreposix.h
35
+ * @brief PCRE definitions
38
+#ifndef _AP_PCREPOSIX_H
39
+#define _AP_PCREPOSIX_H
41
+/* This is the header for the POSIX wrapper interface to the PCRE Perl-
42
+Compatible Regular Expression library. It defines the things POSIX says should
45
+/* Have to include stdlib.h in order to ensure that size_t is defined. */
49
+/* Allow for C++ users */
55
+/* Options defined by POSIX. */
58
+#define AP_REG_ICASE 0x01
59
+ /** Don't match newlines with wildcards */
60
+#define AP_REG_NEWLINE 0x02
61
+ /** Don't match BOL */
62
+#define AP_REG_NOTBOL 0x04
63
+ /** Don't match EOL */
64
+#define AP_REG_NOTEOL 0x08
66
+/* These are not used by PCRE, but by defining them we make it easier
67
+to slot PCRE into existing programs that make POSIX calls. */
70
+#define AP_REG_EXTENDED 0
72
+#define AP_REG_NOSUB 0
74
+/* Error values. Not all these are relevant or used by the wrapper. */
77
+ AP_REG_ASSERT = 1, /* internal error ? */
78
+ AP_REG_ESPACE, /* failed to get memory */
79
+ AP_REG_INVARG, /* bad argument */
80
+ AP_REG_NOMATCH /* match failed */
84
+/* The structure representing a compiled regular expression. */
89
+ size_t re_erroffset;
92
+/* The structure in which a captured offset is returned. */
94
+typedef int ap_regoff_t;
102
+#define AP_DECLARE(x) x
103
+#endif /* AP_DECLARE */
107
+AP_DECLARE(int) ap_regcomp(ap_regex_t *, const char *, int);
110
+ * Match a null-terminated string against a pre-compiled regex.
111
+ * @param preg The pre-compiled regex
112
+ * @param string The string to match
113
+ * @param nmatch Provide information regarding the location of any matches
114
+ * @param pmatch Provide information regarding the location of any matches
115
+ * @param eflags Bitwise or of any of:
116
+ * @li #REG_NOTBOL - match-beginning-of-line operator always
118
+ * @li #REG_NOTEOL - match-end-of-line operator always fails to match
119
+ * @return 0 for successful match, #REG_NOMATCH otherwise
121
+AP_DECLARE(int) ap_regexec(const ap_regex_t *preg, const char *string,
122
+ size_t nmatch, ap_regmatch_t *pmatch, int eflags);
125
+ * Return the error code returned by regcomp or regexec into error messages
126
+ * @param errcode the error code returned by regexec or regcomp
127
+ * @param preg The precompiled regex
128
+ * @param errbuf A buffer to store the error in
129
+ * @param errbuf_size The size of the buffer
131
+AP_DECLARE(size_t) ap_regerror(int errcode, const ap_regex_t *preg,
132
+ char *errbuf, size_t errbuf_size);
134
+/** Destroy a pre-compiled regex.
135
+ * @param preg The pre-compiled regex to free.
137
+AP_DECLARE(void) ap_regfree(ap_regex_t *preg);
143
+#endif /* End of pcreposix.h */
144
diff -urN build-tree.orig/apache2/include/http_core.h build-tree/apache2/include/http_core.h
145
--- build-tree.orig/apache2/include/http_core.h 2005-02-04 13:21:18.000000000 -0700
146
+++ build-tree/apache2/include/http_core.h 2005-02-09 11:25:13.000000000 -0700
150
apr_array_header_t *sec_file;
154
const char *mime_type; /* forced with ForceType */
155
const char *handler; /* forced with SetHandler */
156
diff -urN build-tree.orig/apache2/include/httpd.h build-tree/apache2/include/httpd.h
157
--- build-tree.orig/apache2/include/httpd.h 2005-02-04 13:21:18.000000000 -0700
158
+++ build-tree/apache2/include/httpd.h 2005-02-09 11:25:13.000000000 -0700
163
-#include "pcreposix.h"
164
+#include "ap_regex.h"
166
/* Note: util_uri.h is also included, see below */
168
@@ -1503,7 +1503,7 @@
169
* @li #REG_NEWLINE - Match-any-character operators don't match new-line
170
* @return The compiled regular expression
172
-AP_DECLARE(regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
173
+AP_DECLARE(ap_regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
177
@@ -1511,32 +1511,7 @@
178
* @param p The pool the regex was allocated from
179
* @param reg The regular expression to free
181
-AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t *reg);
184
- * Match a null-terminated string against a pre-compiled regex.
185
- * @param preg The pre-compiled regex
186
- * @param string The string to match
187
- * @param nmatch Provide information regarding the location of any matches
188
- * @param pmatch Provide information regarding the location of any matches
189
- * @param eflags Bitwise or of any of:
190
- * @li #REG_NOTBOL - match-beginning-of-line operator always
192
- * @li #REG_NOTEOL - match-end-of-line operator always fails to match
193
- * @return 0 for successful match, #REG_NOMATCH otherwise
195
-AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string,
196
- size_t nmatch, regmatch_t pmatch[], int eflags);
199
- * Return the error code returned by regcomp or regexec into error messages
200
- * @param errcode the error code returned by regexec or regcomp
201
- * @param preg The precompiled regex
202
- * @param errbuf A buffer to store the error in
203
- * @param errbuf_size The size of the buffer
205
-AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg,
206
- char *errbuf, size_t errbuf_size);
207
+AP_DECLARE(void) ap_pregfree(apr_pool_t *p, ap_regex_t *reg);
210
* After performing a successful regex match, you may use this function to
211
@@ -1550,7 +1525,7 @@
212
* @param pmatch the pmatch array returned from ap_pregex
214
AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input, const char *source,
215
- size_t nmatch, regmatch_t pmatch[]);
216
+ size_t nmatch, ap_regmatch_t pmatch[]);
219
* We want to downcase the type/subtype for comparison purposes
220
diff -urN build-tree.orig/apache2/include/pcreposix.h build-tree/apache2/include/pcreposix.h
221
--- build-tree.orig/apache2/include/pcreposix.h 2004-11-24 12:31:09.000000000 -0700
222
+++ build-tree/apache2/include/pcreposix.h 1969-12-31 17:00:00.000000000 -0700
224
-/*************************************************
225
-* Perl-Compatible Regular Expressions *
226
-*************************************************/
228
-/* Copyright (c) 1997-2000 University of Cambridge */
231
- * @file include/pcreposix.h
232
- * @brief PCRE definitions
235
-#ifndef _PCREPOSIX_H
236
-#define _PCREPOSIX_H
238
-/* This is the header for the POSIX wrapper interface to the PCRE Perl-
239
-Compatible Regular Expression library. It defines the things POSIX says should
240
-be there. I hope. */
242
-/* Have to include stdlib.h in order to ensure that size_t is defined. */
246
-/* Allow for C++ users */
252
-/* Options defined by POSIX. */
255
-#define REG_ICASE 0x01
256
- /** Don't match newlines with wildcards */
257
-#define REG_NEWLINE 0x02
258
- /** Don't match BOL */
259
-#define REG_NOTBOL 0x04
260
- /** Don't match EOL */
261
-#define REG_NOTEOL 0x08
263
-/* These are not used by PCRE, but by defining them we make it easier
264
-to slot PCRE into existing programs that make POSIX calls. */
267
-#define REG_EXTENDED 0
271
-/* Error values. Not all these are relevant or used by the wrapper. */
274
- REG_ASSERT = 1, /* internal error ? */
275
- REG_BADBR, /* invalid repeat counts in {} */
276
- REG_BADPAT, /* pattern error */
277
- REG_BADRPT, /* ? * + invalid */
278
- REG_EBRACE, /* unbalanced {} */
279
- REG_EBRACK, /* unbalanced [] */
280
- REG_ECOLLATE, /* collation error - not relevant */
281
- REG_ECTYPE, /* bad class */
282
- REG_EESCAPE, /* bad escape sequence */
283
- REG_EMPTY, /* empty expression */
284
- REG_EPAREN, /* unbalanced () */
285
- REG_ERANGE, /* bad range inside [] */
286
- REG_ESIZE, /* expression too big */
287
- REG_ESPACE, /* failed to get memory */
288
- REG_ESUBREG, /* bad back reference */
289
- REG_INVARG, /* bad argument */
290
- REG_NOMATCH /* match failed */
294
-/* The structure representing a compiled regular expression. */
299
- size_t re_erroffset;
302
-/* The structure in which a captured offset is returned. */
304
-typedef int regoff_t;
313
-extern int regcomp(regex_t *, const char *, int);
314
-extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int);
315
-extern size_t regerror(int, const regex_t *, char *, size_t);
316
-extern void regfree(regex_t *);
322
-#endif /* End of pcreposix.h */
323
diff -urN build-tree.orig/apache2/modules/filters/mod_include.c build-tree/apache2/modules/filters/mod_include.c
324
--- build-tree.orig/apache2/modules/filters/mod_include.c 2005-02-04 13:21:18.000000000 -0700
325
+++ build-tree/apache2/modules/filters/mod_include.c 2005-02-09 11:25:13.000000000 -0700
326
@@ -1173,11 +1173,11 @@
327
static int re_check(request_rec *r, include_ctx_t *ctx,
328
char *string, char *rexp)
331
- const apr_size_t nres = sizeof(*ctx->re_result) / sizeof(regmatch_t);
332
+ ap_regex_t *compiled;
333
+ const apr_size_t nres = sizeof(*ctx->re_result) / sizeof(ap_regmatch_t);
336
- compiled = ap_pregcomp(r->pool, rexp, REG_EXTENDED | REG_NOSUB);
337
+ compiled = ap_pregcomp(r->pool, rexp, AP_REG_EXTENDED | AP_REG_NOSUB);
338
if (compiled == NULL) {
339
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
340
"unable to compile pattern \"%s\"", rexp);
341
diff -urN build-tree.orig/apache2/modules/filters/mod_include.h build-tree/apache2/modules/filters/mod_include.h
342
--- build-tree.orig/apache2/modules/filters/mod_include.h 2005-02-04 13:21:18.000000000 -0700
343
+++ build-tree/apache2/modules/filters/mod_include.h 2005-02-09 11:25:13.000000000 -0700
348
- regmatch_t (*re_result)[10];
349
+ ap_regmatch_t (*re_result)[10];
352
/* These flags are used to set flag bits. */
353
diff -urN build-tree.orig/apache2/modules/mappers/mod_alias.c build-tree/apache2/modules/mappers/mod_alias.c
354
--- build-tree.orig/apache2/modules/mappers/mod_alias.c 2005-02-04 13:21:18.000000000 -0700
355
+++ build-tree/apache2/modules/mappers/mod_alias.c 2005-02-09 11:25:13.000000000 -0700
361
+ ap_regex_t *regexp;
362
int redir_status; /* 301, 302, 303, 410, etc */
366
/* XX r can NOT be relative to DocumentRoot here... compat bug. */
369
- new->regexp = ap_pregcomp(cmd->pool, f, REG_EXTENDED);
370
+ new->regexp = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED);
371
if (new->regexp == NULL)
372
return "Regular expression could not be compiled.";
375
alias_server_conf *serverconf = ap_get_module_config(s->module_config,
377
int status = (int) (long) cmd->info;
379
+ ap_regex_t *r = NULL;
380
const char *f = arg2;
381
const char *url = arg3;
387
- r = ap_pregcomp(cmd->pool, f, REG_EXTENDED);
388
+ r = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED);
390
return "Regular expression could not be compiled.";
393
int doesc, int *status)
395
alias_entry *entries = (alias_entry *) aliases->elts;
396
- regmatch_t regm[AP_MAX_REG_MATCH];
397
+ ap_regmatch_t regm[AP_MAX_REG_MATCH];
401
diff -urN build-tree.orig/apache2/modules/mappers/mod_rewrite.c build-tree/apache2/modules/mappers/mod_rewrite.c
402
--- build-tree.orig/apache2/modules/mappers/mod_rewrite.c 2005-02-04 13:21:18.000000000 -0700
403
+++ build-tree/apache2/modules/mappers/mod_rewrite.c 2005-02-09 11:25:13.000000000 -0700
405
char *str = apr_pstrdup(cmd->pool, in_str);
406
rewrite_server_conf *sconf;
407
rewritecond_entry *newcond;
409
+ ap_regex_t *regexp;
413
@@ -602,11 +602,11 @@
414
we can compile the pattern for case insensitive matching,
415
under the old V8 library we have to do it self via a hack */
416
if (newcond->flags & CONDFLAG_NOCASE) {
417
- rc = ((regexp = ap_pregcomp(cmd->pool, cp, REG_EXTENDED|REG_ICASE))
418
+ rc = ((regexp = ap_pregcomp(cmd->pool, cp, AP_REG_EXTENDED|AP_REG_ICASE))
422
- rc = ((regexp = ap_pregcomp(cmd->pool, cp, REG_EXTENDED)) == NULL);
423
+ rc = ((regexp = ap_pregcomp(cmd->pool, cp, AP_REG_EXTENDED)) == NULL);
426
return apr_pstrcat(cmd->pool,
428
char *str = apr_pstrdup(cmd->pool, in_str);
429
rewrite_server_conf *sconf;
430
rewriterule_entry *newrule;
432
+ ap_regex_t *regexp;
437
newrule->flags |= RULEFLAG_NOTMATCH;
440
- mode = REG_EXTENDED;
441
+ mode = AP_REG_EXTENDED;
442
if (newrule->flags & RULEFLAG_NOCASE) {
444
+ mode |= AP_REG_ICASE;
446
if ((regexp = ap_pregcomp(cmd->pool, cp, mode)) == NULL) {
447
return apr_pstrcat(cmd->pool,
448
@@ -1945,8 +1945,8 @@
451
char newuri[MAX_STRING_LEN];
453
- regmatch_t regmatch[AP_MAX_REG_MATCH];
454
+ ap_regex_t *regexp;
455
+ ap_regmatch_t regmatch[AP_MAX_REG_MATCH];
456
backrefinfo *briRR = NULL;
457
backrefinfo *briRC = NULL;
459
@@ -2303,7 +2303,7 @@
460
char input[MAX_STRING_LEN];
463
- regmatch_t regmatch[AP_MAX_REG_MATCH];
464
+ ap_regmatch_t regmatch[AP_MAX_REG_MATCH];
468
diff -urN build-tree.orig/apache2/modules/mappers/mod_rewrite.h build-tree/apache2/modules/mappers/mod_rewrite.h
469
--- build-tree.orig/apache2/modules/mappers/mod_rewrite.h 2005-02-04 13:21:18.000000000 -0700
470
+++ build-tree/apache2/modules/mappers/mod_rewrite.h 2005-02-09 11:25:13.000000000 -0700
471
@@ -199,14 +199,14 @@
473
char *input; /* Input string of RewriteCond */
474
char *pattern; /* the RegExp pattern string */
476
+ ap_regex_t *regexp;
477
int flags; /* Flags which control the match */
481
apr_array_header_t *rewriteconds; /* the corresponding RewriteCond entries */
482
char *pattern; /* the RegExp pattern string */
483
- regex_t *regexp; /* the RegExp pattern compilation */
484
+ ap_regex_t *regexp; /* the RegExp pattern compilation */
485
char *output; /* the Substitution string */
486
int flags; /* Flags which control the substitution */
487
char *forced_mimetype; /* forced MIME type of substitution */
489
typedef struct backrefinfo {
492
- regmatch_t regmatch[AP_MAX_REG_MATCH];
493
+ ap_regmatch_t regmatch[AP_MAX_REG_MATCH];
497
diff -urN build-tree.orig/apache2/modules/metadata/mod_headers.c build-tree/apache2/modules/metadata/mod_headers.c
498
--- build-tree.orig/apache2/modules/metadata/mod_headers.c 2005-02-04 13:21:18.000000000 -0700
499
+++ build-tree/apache2/modules/metadata/mod_headers.c 2005-02-09 11:25:13.000000000 -0700
503
apr_array_header_t *ta; /* Array of format_tag structs */
506
const char *condition_var;
509
@@ -344,13 +344,13 @@
510
return "header unset takes two arguments";
512
else if (new->action == hdr_echo) {
516
return "Header echo takes two arguments";
517
else if (cmd->info == &hdr_in)
518
return "Header echo only valid on Header directive";
520
- regex = ap_pregcomp(cmd->pool, hdr, REG_EXTENDED | REG_NOSUB);
521
+ regex = ap_pregcomp(cmd->pool, hdr, AP_REG_EXTENDED | AP_REG_NOSUB);
523
return "Header echo regex could not be compiled";
525
diff -urN build-tree.orig/apache2/modules/metadata/mod_setenvif.c build-tree/apache2/modules/metadata/mod_setenvif.c
526
--- build-tree.orig/apache2/modules/metadata/mod_setenvif.c 2005-02-04 13:21:18.000000000 -0700
527
+++ build-tree/apache2/modules/metadata/mod_setenvif.c 2005-02-09 11:25:13.000000000 -0700
531
char *name; /* header name */
532
- regex_t *pnamereg; /* compiled header name regex */
533
+ ap_regex_t *pnamereg; /* compiled header name regex */
534
char *regex; /* regex to match against */
535
- regex_t *preg; /* compiled regex */
536
+ ap_regex_t *preg; /* compiled regex */
537
const apr_strmatch_pattern *pattern; /* non-regex pattern to match */
538
apr_table_t *features; /* env vars to set (or unset) */
539
enum special special_type; /* is it a "special" header ? */
544
- * any non-NULL magic constant will do... used to indicate if REG_ICASE should
545
+ * any non-NULL magic constant will do... used to indicate if AP_REG_ICASE should
548
#define ICASE_MAGIC ((void *)(&setenvif_module))
550
* -,_,[A-Z\, [a-z] and [0-9].
551
* assume the header name is a regular expression.
553
- regex_t *preg = ap_pregcomp(p, "^[-A-Za-z0-9_]*$",
554
- (REG_EXTENDED | REG_NOSUB ));
555
+ ap_regex_t *preg = ap_pregcomp(p, "^[-A-Za-z0-9_]*$",
556
+ (AP_REG_EXTENDED | AP_REG_NOSUB ));
557
ap_assert(preg != NULL);
559
if (ap_regexec(preg, name, 0, NULL, 0)) {
563
new->preg = ap_pregcomp(cmd->pool, regex,
564
- (REG_EXTENDED | (icase ? REG_ICASE : 0)));
565
+ (AP_REG_EXTENDED | (icase ? AP_REG_ICASE : 0)));
566
if (new->preg == NULL) {
567
return apr_pstrcat(cmd->pool, cmd->cmd->name,
568
" regex could not be compiled.", NULL);
571
if (is_header_regex(cmd->pool, fname)) {
572
new->pnamereg = ap_pregcomp(cmd->pool, fname,
573
- (REG_EXTENDED | REG_NOSUB
574
- | (icase ? REG_ICASE : 0)));
575
+ (AP_REG_EXTENDED | AP_REG_NOSUB
576
+ | (icase ? AP_REG_ICASE : 0)));
577
if (new->pnamereg == NULL)
578
return apr_pstrcat(cmd->pool, cmd->cmd->name,
579
"Header name regex could not be "
581
apr_size_t val_len = 0;
584
- regmatch_t regm[AP_MAX_REG_MATCH];
585
+ ap_regmatch_t regm[AP_MAX_REG_MATCH];
587
if (!ap_get_module_config(r->request_config, &setenvif_module)) {
588
ap_set_module_config(r->request_config, &setenvif_module,
589
diff -urN build-tree.orig/apache2/modules/metadata/mod_usertrack.c build-tree/apache2/modules/metadata/mod_usertrack.c
590
--- build-tree.orig/apache2/modules/metadata/mod_usertrack.c 2005-02-04 13:21:18.000000000 -0700
591
+++ build-tree/apache2/modules/metadata/mod_usertrack.c 2005-02-09 11:25:13.000000000 -0700
595
char *regexp_string; /* used to compile regexp; save for debugging */
596
- regex_t *regexp; /* used to find usertrack cookie in cookie header */
597
+ ap_regex_t *regexp; /* used to find usertrack cookie in cookie header */
600
/* Make Cookie: Now we have to generate something that is going to be
605
- dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
606
+ dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, AP_REG_EXTENDED);
607
ap_assert(dcfg->regexp != NULL);
611
cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
613
const char *cookie_header;
614
- regmatch_t regm[NUM_SUBS];
615
+ ap_regmatch_t regm[NUM_SUBS];
617
/* Do not run in subrequests */
618
if (!dcfg->enabled || r->main) {
619
diff -urN build-tree.orig/apache2/modules/proxy/mod_proxy.c build-tree/apache2/modules/proxy/mod_proxy.c
620
--- build-tree.orig/apache2/modules/proxy/mod_proxy.c 2005-02-04 13:21:18.000000000 -0700
621
+++ build-tree/apache2/modules/proxy/mod_proxy.c 2005-02-09 11:25:13.000000000 -0700
623
struct proxy_remote *new;
625
char *r, *f, *scheme;
626
- regex_t *reg = NULL;
627
+ ap_regex_t *reg = NULL;
630
r = apr_pstrdup(cmd->pool, r1);
635
- reg = ap_pregcomp(cmd->pool, f, REG_EXTENDED);
636
+ reg = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED);
638
return "Regular expression for ProxyRemoteMatch could not be compiled.";
641
char *old_path = cmd->path;
642
proxy_dir_conf *conf;
643
ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool);
645
+ ap_regex_t *r = NULL;
646
const command_rec *thiscmd = cmd->cmd;
648
const char *err = ap_check_cmd_context(cmd,
650
* scheme? See proxy_fixup()
652
if (thiscmd->cmd_data) { /* <ProxyMatch> */
653
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
654
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
656
return "Regex could not be compiled";
659
return "<Proxy ~ > block must specify a path";
660
if (strncasecmp(cmd->path, "proxy:", 6))
662
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
663
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
665
return "Regex could not be compiled";
667
diff -urN build-tree.orig/apache2/modules/proxy/mod_proxy.h build-tree/apache2/modules/proxy/mod_proxy.h
668
--- build-tree.orig/apache2/modules/proxy/mod_proxy.h 2005-02-04 13:21:18.000000000 -0700
669
+++ build-tree/apache2/modules/proxy/mod_proxy.h 2005-02-09 11:25:13.000000000 -0700
671
const char *protocol; /* the scheme used to talk to this proxy */
672
const char *hostname; /* the hostname of this proxy */
673
apr_port_t port; /* the port for this proxy */
674
- regex_t *regexp; /* compiled regex (if any) for the remote */
675
+ ap_regex_t *regexp; /* compiled regex (if any) for the remote */
676
int use_regex; /* simple boolean. True if we have a regex pattern */
681
const char *p; /* The path */
682
int p_is_fnmatch; /* Is this path an fnmatch candidate? */
683
- regex_t *r; /* Is this a regex? */
684
+ ap_regex_t *r; /* Is this a regex? */
688
diff -urN build-tree.orig/apache2/modules/proxy/proxy_ftp.c build-tree/apache2/modules/proxy/proxy_ftp.c
689
--- build-tree.orig/apache2/modules/proxy/proxy_ftp.c 2005-02-04 13:21:18.000000000 -0700
690
+++ build-tree/apache2/modules/proxy/proxy_ftp.c 2005-02-09 11:25:13.000000000 -0700
691
@@ -426,11 +426,11 @@
695
- regex_t *re = NULL;
696
- regmatch_t re_result[LS_REG_MATCH];
697
+ ap_regex_t *re = NULL;
698
+ ap_regmatch_t re_result[LS_REG_MATCH];
700
/* Compile the output format of "ls -s1" as a fallback for non-unix ftp listings */
701
- re = ap_pregcomp(p, LS_REG_PATTERN, REG_EXTENDED);
702
+ re = ap_pregcomp(p, LS_REG_PATTERN, AP_REG_EXTENDED);
703
ap_assert(re != NULL);
705
/* get a complete line */
706
diff -urN build-tree.orig/apache2/modules/ssl/ssl_expr_eval.c build-tree/apache2/modules/ssl/ssl_expr_eval.c
707
--- build-tree.orig/apache2/modules/ssl/ssl_expr_eval.c 2005-02-04 13:21:18.000000000 -0700
708
+++ build-tree/apache2/modules/ssl/ssl_expr_eval.c 2005-02-09 11:25:13.000000000 -0700
709
@@ -126,24 +126,24 @@
716
e1 = (ssl_expr *)node->node_arg1;
717
e2 = (ssl_expr *)node->node_arg2;
718
word = ssl_expr_eval_word(r, e1);
719
- regex = (regex_t *)(e2->node_arg1);
720
+ regex = (ap_regex_t *)(e2->node_arg1);
721
return (ap_regexec(regex, word, 0, NULL, 0) == 0);
730
e1 = (ssl_expr *)node->node_arg1;
731
e2 = (ssl_expr *)node->node_arg2;
732
word = ssl_expr_eval_word(r, e1);
733
- regex = (regex_t *)(e2->node_arg1);
734
+ regex = (ap_regex_t *)(e2->node_arg1);
735
return !(ap_regexec(regex, word, 0, NULL, 0) == 0);
738
diff -urN build-tree.orig/apache2/modules/ssl/ssl_expr_parse.c build-tree/apache2/modules/ssl/ssl_expr_parse.c
739
--- build-tree.orig/apache2/modules/ssl/ssl_expr_parse.c 2005-02-07 10:23:43.000000000 -0700
740
+++ build-tree/apache2/modules/ssl/ssl_expr_parse.c 2005-02-09 11:25:13.000000000 -0700
743
#line 148 "ssl_expr_parse.y"
747
if ((regex = ap_pregcomp(ssl_expr_info.pool, ssl_expr_yyvsp[0].cpVal,
748
- REG_EXTENDED|REG_NOSUB)) == NULL) {
749
+ AP_REG_EXTENDED|AP_REG_NOSUB)) == NULL) {
750
ssl_expr_error = "Failed to compile regular expression";
755
#line 158 "ssl_expr_parse.y"
759
if ((regex = ap_pregcomp(ssl_expr_info.pool, ssl_expr_yyvsp[0].cpVal,
760
- REG_EXTENDED|REG_NOSUB|REG_ICASE)) == NULL) {
761
+ AP_REG_EXTENDED|AP_REG_NOSUB|AP_REG_ICASE)) == NULL) {
762
ssl_expr_error = "Failed to compile regular expression";
765
diff -urN build-tree.orig/apache2/modules/ssl/ssl_expr_parse.y build-tree/apache2/modules/ssl/ssl_expr_parse.y
766
--- build-tree.orig/apache2/modules/ssl/ssl_expr_parse.y 2005-02-07 10:23:36.000000000 -0700
767
+++ build-tree/apache2/modules/ssl/ssl_expr_parse.y 2005-02-09 11:25:13.000000000 -0700
768
@@ -112,18 +112,18 @@
774
if ((regex = ap_pregcomp(ssl_expr_info.pool, $1,
775
- REG_EXTENDED|REG_NOSUB)) == NULL) {
776
+ AP_REG_EXTENDED|AP_REG_NOSUB)) == NULL) {
777
ssl_expr_error = "Failed to compile regular expression";
780
$$ = ssl_expr_make(op_Regex, regex, NULL);
785
if ((regex = ap_pregcomp(ssl_expr_info.pool, $1,
786
- REG_EXTENDED|REG_NOSUB|REG_ICASE)) == NULL) {
787
+ AP_REG_EXTENDED|AP_REG_NOSUB|AP_REG_ICASE)) == NULL) {
788
ssl_expr_error = "Failed to compile regular expression";
791
diff -urN build-tree.orig/apache2/server/Makefile.in build-tree/apache2/server/Makefile.in
792
--- build-tree.orig/apache2/server/Makefile.in 2005-02-04 10:40:14.000000000 -0700
793
+++ build-tree/apache2/server/Makefile.in 2005-02-09 11:25:13.000000000 -0700
795
util_script.c util_md5.c util_cfgtree.c util_ebcdic.c util_time.c \
796
rfc1413.c connection.c listen.c \
797
mpm_common.c util_charset.c util_debug.c util_xml.c \
798
- util_filter.c exports.c buildmark.c \
799
+ util_filter.c util_pcre.c exports.c buildmark.c \
800
scoreboard.c error_bucket.c protocol.c core.c request.c provider.c \
803
diff -urN build-tree.orig/apache2/server/core.c build-tree/apache2/server/core.c
804
--- build-tree.orig/apache2/server/core.c 2005-02-04 13:21:18.000000000 -0700
805
+++ build-tree/apache2/server/core.c 2005-02-09 11:25:13.000000000 -0700
806
@@ -1618,7 +1618,7 @@
810
-#define USE_ICASE REG_ICASE
811
+#define USE_ICASE AP_REG_ICASE
815
@@ -1640,7 +1640,7 @@
816
char *old_path = cmd->path;
817
core_dir_config *conf;
818
ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool);
820
+ ap_regex_t *r = NULL;
821
const command_rec *thiscmd = cmd->cmd;
823
const char *err = ap_check_cmd_context(cmd,
824
@@ -1669,13 +1669,13 @@
825
cmd->path = ap_getword_conf(cmd->pool, &arg);
827
return "<Directory ~ > block must specify a path";
828
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
829
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
831
return "Regex could not be compiled";
834
else if (thiscmd->cmd_data) { /* <DirectoryMatch> */
835
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
836
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
838
return "Regex could not be compiled";
840
@@ -1740,7 +1740,7 @@
841
int old_overrides = cmd->override;
842
char *old_path = cmd->path;
843
core_dir_config *conf;
845
+ ap_regex_t *r = NULL;
846
const command_rec *thiscmd = cmd->cmd;
847
ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool);
848
const char *err = ap_check_cmd_context(cmd,
849
@@ -1759,14 +1759,14 @@
850
cmd->override = OR_ALL|ACCESS_CONF;
852
if (thiscmd->cmd_data) { /* <LocationMatch> */
853
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
854
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
856
return "Regex could not be compiled";
859
else if (!strcmp(cmd->path, "~")) {
860
cmd->path = ap_getword_conf(cmd->pool, &arg);
861
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
862
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
864
return "Regex could not be compiled";
866
@@ -1804,7 +1804,7 @@
867
int old_overrides = cmd->override;
868
char *old_path = cmd->path;
869
core_dir_config *conf;
871
+ ap_regex_t *r = NULL;
872
const command_rec *thiscmd = cmd->cmd;
873
core_dir_config *c = mconfig;
874
ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool);
875
@@ -1827,14 +1827,14 @@
878
if (thiscmd->cmd_data) { /* <FilesMatch> */
879
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
880
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
882
return "Regex could not be compiled";
885
else if (!strcmp(cmd->path, "~")) {
886
cmd->path = ap_getword_conf(cmd->pool, &arg);
887
- r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE);
888
+ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
890
return "Regex could not be compiled";
892
diff -urN build-tree.orig/apache2/server/request.c build-tree/apache2/server/request.c
893
--- build-tree.orig/apache2/server/request.c 2005-02-04 13:21:18.000000000 -0700
894
+++ build-tree/apache2/server/request.c 2005-02-09 11:25:13.000000000 -0700
895
@@ -1040,7 +1040,7 @@
899
- if (ap_regexec(entry_core->r, r->filename, 0, NULL, REG_NOTEOL)) {
900
+ if (ap_regexec(entry_core->r, r->filename, 0, NULL, AP_REG_NOTEOL)) {
904
diff -urN build-tree.orig/apache2/server/util.c build-tree/apache2/server/util.c
905
--- build-tree.orig/apache2/server/util.c 2005-02-04 13:21:18.000000000 -0700
906
+++ build-tree/apache2/server/util.c 2005-02-09 11:25:13.000000000 -0700
907
@@ -256,16 +256,16 @@
909
static apr_status_t regex_cleanup(void *preg)
911
- regfree((regex_t *) preg);
912
+ ap_regfree((ap_regex_t *) preg);
916
-AP_DECLARE(regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
917
+AP_DECLARE(ap_regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
920
- regex_t *preg = apr_palloc(p, sizeof(regex_t));
921
+ ap_regex_t *preg = apr_palloc(p, sizeof *preg);
923
- if (regcomp(preg, pattern, cflags)) {
924
+ if (ap_regcomp(preg, pattern, cflags)) {
932
-AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t * reg)
933
+AP_DECLARE(void) ap_pregfree(apr_pool_t *p, ap_regex_t * reg)
937
apr_pool_cleanup_kill(p, (void *) reg, regex_cleanup);
945
- * Apache stub function for the regex libraries regexec() to make sure the
946
- * whole regex(3) API is available through the Apache (exported) namespace.
947
- * This is especially important for the DSO situations of modules.
948
- * DO NOT MAKE A MACRO OUT OF THIS FUNCTION!
950
-AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string,
951
- size_t nmatch, regmatch_t pmatch[], int eflags)
953
- return regexec(preg, string, nmatch, pmatch, eflags);
956
-AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, char *errbuf,
957
- size_t errbuf_size)
959
- return regerror(errcode, preg, errbuf, errbuf_size);
963
/* This function substitutes for $0-$9, filling in regular expression
964
* submatches. Pass it the same nmatch and pmatch arguments that you
965
* passed ap_regexec(). pmatch should not be greater than the maximum number
968
AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
969
const char *source, size_t nmatch,
970
- regmatch_t pmatch[])
971
+ ap_regmatch_t pmatch[])
973
const char *src = input;
975
diff -urN build-tree.orig/apache2/server/util_pcre.c build-tree/apache2/server/util_pcre.c
976
--- build-tree.orig/apache2/server/util_pcre.c 1969-12-31 17:00:00.000000000 -0700
977
+++ build-tree/apache2/server/util_pcre.c 2005-02-09 11:25:13.000000000 -0700
979
+/*************************************************
980
+* Perl-Compatible Regular Expressions *
981
+*************************************************/
984
+This is a library of functions to support regular expressions whose syntax
985
+and semantics are as close as possible to those of the Perl 5 language. See
986
+the file Tech.Notes for some information on the internals.
988
+This module is a wrapper that provides a POSIX API to the underlying PCRE
991
+Written by: Philip Hazel <ph10@cam.ac.uk>
993
+ Copyright (c) 1997-2001 University of Cambridge
995
+-----------------------------------------------------------------------------
996
+Permission is granted to anyone to use this software for any purpose on any
997
+computer system, and to redistribute it freely, subject to the following
1000
+1. This software is distributed in the hope that it will be useful,
1001
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1002
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1004
+2. The origin of this software must not be misrepresented, either by
1005
+ explicit claim or by omission.
1007
+3. Altered versions must be plainly marked as such, and must not be
1008
+ misrepresented as being the original software.
1010
+4. If PCRE is embedded in any software that is released under the GNU
1011
+ General Purpose Licence (GPL), then the terms of that licence shall
1012
+ supersede any condition above with which it is incompatible.
1013
+-----------------------------------------------------------------------------
1016
+#include <stdlib.h>
1018
+#include "ap_regex.h"
1021
+#ifndef POSIX_MALLOC_THRESHOLD
1022
+#define POSIX_MALLOC_THRESHOLD (10)
1025
+/* Table of error strings corresponding to POSIX error codes; must be
1026
+ * kept in synch with include/ap_regex.h's AP_REG_E* definitions. */
1028
+static const char *const pstring[] = {
1029
+ "", /* Dummy for value 0 */
1030
+ "internal error", /* AP_REG_ASSERT */
1031
+ "failed to get memory", /* AP_REG_ESPACE */
1032
+ "bad argument", /* AP_REG_INVARG */
1033
+ "match failed" /* AP_REG_NOMATCH */
1036
+AP_DECLARE(size_t) ap_regerror(int errcode, const ap_regex_t *preg,
1037
+ char *errbuf, size_t errbuf_size)
1039
+const char *message, *addmessage;
1040
+size_t length, addlength;
1042
+message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
1043
+ "unknown error code" : pstring[errcode];
1044
+length = strlen(message) + 1;
1046
+addmessage = " at offset ";
1047
+addlength = (preg != NULL && (int)preg->re_erroffset != -1)?
1048
+ strlen(addmessage) + 6 : 0;
1050
+if (errbuf_size > 0)
1052
+ if (addlength > 0 && errbuf_size >= length + addlength)
1053
+ sprintf(errbuf, "%s%s%-6d", message, addmessage, (int)preg->re_erroffset);
1056
+ strncpy(errbuf, message, errbuf_size - 1);
1057
+ errbuf[errbuf_size-1] = 0;
1061
+return length + addlength;
1067
+/*************************************************
1068
+* Free store held by a regex *
1069
+*************************************************/
1071
+AP_DECLARE(void) ap_regfree(ap_regex_t *preg)
1073
+(pcre_free)(preg->re_pcre);
1079
+/*************************************************
1080
+* Compile a regular expression *
1081
+*************************************************/
1085
+ preg points to a structure for recording the compiled expression
1086
+ pattern the pattern to compile
1087
+ cflags compilation flags
1089
+Returns: 0 on success
1090
+ various non-zero codes on failure
1093
+AP_DECLARE(int) ap_regcomp(ap_regex_t *preg, const char *pattern, int cflags)
1095
+const char *errorptr;
1099
+if ((cflags & AP_REG_ICASE) != 0) options |= PCRE_CASELESS;
1100
+if ((cflags & AP_REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
1102
+preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
1103
+preg->re_erroffset = erroffset;
1105
+if (preg->re_pcre == NULL) return AP_REG_INVARG;
1107
+preg->re_nsub = pcre_info(preg->re_pcre, NULL, NULL);
1114
+/*************************************************
1115
+* Match a regular expression *
1116
+*************************************************/
1118
+/* Unfortunately, PCRE requires 3 ints of working space for each captured
1119
+substring, so we have to get and release working store instead of just using
1120
+the POSIX structures as was done in earlier releases when PCRE needed only 2
1123
+#define SMALL_NMATCH 5
1124
+AP_DECLARE(int) ap_regexec(const ap_regex_t *preg, const char *string, size_t nmatch,
1125
+ ap_regmatch_t pmatch[], int eflags)
1129
+/* NOTE: The code related to the "SMALL_NMATCH" optimization
1130
+ * currently is unique to the httpd-2.0 copy of PCRE 3.9. I've
1131
+ * submitted the patch to the PCRE maintainer for inclusion in
1132
+ * the next PCRE release, slated for late 2002. At that time,
1133
+ * we can merge the new PCRE version into the httpd-2.0/srclib
1134
+ * tree. --brianp 3/20/2002
1136
+int small_ovector[SMALL_NMATCH * 3];
1137
+int *ovector = NULL;
1138
+int allocated_ovector = 0;
1140
+if ((eflags & AP_REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
1141
+if ((eflags & AP_REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
1144
+/* This causes a memory segfault after locking the const, thread-shared *preg
1145
+ * generated at compile time, and is entirely unnecessary.
1147
+((ap_regex_t *)preg->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
1152
+ if (nmatch <= SMALL_NMATCH)
1154
+ ovector = &(small_ovector[0]);
1158
+ ovector = (int *)malloc(sizeof(int) * nmatch * 3);
1159
+ if (ovector == NULL) return AP_REG_ESPACE;
1160
+ allocated_ovector = 1;
1164
+rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options,
1165
+ ovector, nmatch * 3);
1167
+if (rc == 0) rc = nmatch; /* All captured slots were filled in */
1172
+ for (i = 0; i < (size_t) rc; i++)
1174
+ pmatch[i].rm_so = ovector[i*2];
1175
+ pmatch[i].rm_eo = ovector[i*2+1];
1177
+ if (allocated_ovector) free(ovector);
1178
+ for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
1184
+ if (allocated_ovector) free(ovector);
1187
+ case PCRE_ERROR_NOMATCH: return AP_REG_NOMATCH;
1188
+ case PCRE_ERROR_NULL: return AP_REG_INVARG;
1189
+ case PCRE_ERROR_BADOPTION: return AP_REG_INVARG;
1190
+ case PCRE_ERROR_BADMAGIC: return AP_REG_INVARG;
1191
+ case PCRE_ERROR_UNKNOWN_NODE: return AP_REG_ASSERT;
1192
+ case PCRE_ERROR_NOMEMORY: return AP_REG_ESPACE;
1193
+ default: return AP_REG_ASSERT;
1198
+/* End of pcreposix.c */
1199
diff -urN build-tree.orig/apache2/srclib/pcre/Makefile.in build-tree/apache2/srclib/pcre/Makefile.in
1200
--- build-tree.orig/apache2/srclib/pcre/Makefile.in 2004-11-24 12:31:09.000000000 -0700
1201
+++ build-tree/apache2/srclib/pcre/Makefile.in 2005-02-09 11:25:13.000000000 -0700
1203
LTLIBRARY_NAME = libpcre.la
1204
-LTLIBRARY_SOURCES = maketables.c get.c study.c pcre.c pcreposix.c
1205
+LTLIBRARY_SOURCES = maketables.c get.c study.c pcre.c
1207
CLEAN_TARGETS = dftables chartables.c
1208
DISTCLEAN_TARGETS = pcre.h pcre-config config.h config.log config.status $(CLEAN_TARGETS)