2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "chxj_apply_convrule.h"
20 static int s_apply_rule(request_rec* r, chxjconvrule_entry* pp);
23 chxj_apply_convrule(request_rec* r, apr_array_header_t* convrules)
25 chxjconvrule_entry *entries;
26 chxjconvrule_entry *pp;
29 entries = (chxjconvrule_entry *)convrules->elts;
30 for (ii = 0; ii < convrules->nelts; ii++) {
33 if (r->main != NULL) continue;
36 if (s_apply_rule(r, pp))
43 s_apply_rule(request_rec* r, chxjconvrule_entry* pp)
47 ap_regmatch_t regmatch[AP_MAX_REG_MATCH];
51 DBG(r,"convert rule pattern=[%s] uri=[%s]", pp->pattern, uri);
53 rtn = ap_regexec((const ap_regex_t*)pp->regexp, uri, AP_MAX_REG_MATCH, (ap_regmatch_t*)regmatch, 0);
56 if (pp->flags & CONVRULE_FLAG_NOTMATCH) {
63 if (!(pp->flags & CONVRULE_FLAG_NOTMATCH)) {