cache_util.c revision 4925c3916068520021d069924485e16af2168333
9919ac99642adc61c32e5578d5f01a785d0aecaddpejesh/* Licensed to the Apache Software Foundation (ASF) under one or more
9919ac99642adc61c32e5578d5f01a785d0aecaddpejesh * contributor license agreements. See the NOTICE file distributed with
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * this work for additional information regarding copyright ownership.
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * The ASF licenses this file to You under the Apache License, Version 2.0
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * (the "License"); you may not use this file except in compliance with
9919ac99642adc61c32e5578d5f01a785d0aecaddpejesh * the License. You may obtain a copy of the License at
9919ac99642adc61c32e5578d5f01a785d0aecaddpejesh *
9919ac99642adc61c32e5578d5f01a785d0aecaddpejesh * http://www.apache.org/licenses/LICENSE-2.0
5a58787efeb02a1c3f06569d019ad81fd2efa06end *
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc * Unless required by applicable law or agreed to in writing, software
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim * distributed under the License is distributed on an "AS IS" BASIS,
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * See the License for the specific language governing permissions and
2e545ce2450a9953665f701bb05350f0d3f26275nd * limitations under the License.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen */
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim#include "mod_cache.h"
5a58787efeb02a1c3f06569d019ad81fd2efa06end
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen#include <ap_provider.h>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim/* -------------------------------------------------------------- */
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim
5a58787efeb02a1c3f06569d019ad81fd2efa06endextern APR_OPTIONAL_FN_TYPE(ap_cache_generate_key) *cache_generate_key;
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
3b3b7fc78d1f5bfc2769903375050048ff41ff26ndextern module AP_MODULE_DECLARE_DATA cache_module;
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim
cac3c497ee99fac7d83f6e8bd05cb72eaaf95d8fgryzor/* Determine if "url" matches the hostname, scheme and port and path
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd * in "filter". All but the path comparisons are case-insensitive.
e609c337f729875bc20e01096c7e610f45356f54nilgun */
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjungstatic int uri_meets_conditions(apr_uri_t filter, int pathlen, apr_uri_t url)
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd{
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd /* Compare the hostnames */
99dccefe46af69eec3f338c289a2d810950a5475jsl if(filter.hostname) {
c68aa7f213d409d464eaa6b963afb28678548f4frbowen if (!url.hostname) {
654d8eb036bedc99e90e11910ee02d3421417697rbowen return 0;
99dccefe46af69eec3f338c289a2d810950a5475jsl }
a3aa43d21e7abbcdb089e5262d4e58dc3e50bacbrbowen else if (strcasecmp(filter.hostname, url.hostname)) {
a3aa43d21e7abbcdb089e5262d4e58dc3e50bacbrbowen return 0;
a3aa43d21e7abbcdb089e5262d4e58dc3e50bacbrbowen }
5a58787efeb02a1c3f06569d019ad81fd2efa06end }
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim /* Compare the schemes */
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim if(filter.scheme) {
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim if (!url.scheme) {
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh return 0;
7add1372edb1ee95a2c4d1314df4c7567bda7c62jim }
5a58787efeb02a1c3f06569d019ad81fd2efa06end else if (strcasecmp(filter.scheme, url.scheme)) {
5a58787efeb02a1c3f06569d019ad81fd2efa06end return 0;
9919ac99642adc61c32e5578d5f01a785d0aecaddpejesh }
99dccefe46af69eec3f338c289a2d810950a5475jsl }
4aa603e6448b99f9371397d439795c91a93637eand
e55b1e1cb92712fe6621cbf1fb05c99b1c23206chumbedooh /* Compare the ports */
e55b1e1cb92712fe6621cbf1fb05c99b1c23206chumbedooh if(filter.port_str) {
4a56677aad9b66a36f3dc9fddbca8dc1230ad471rbowen if (url.port_str && filter.port != url.port) {
4aa603e6448b99f9371397d439795c91a93637eand return 0;
e55b1e1cb92712fe6621cbf1fb05c99b1c23206chumbedooh }
99dccefe46af69eec3f338c289a2d810950a5475jsl /* NOTE: ap_port_of_scheme will return 0 if given NULL input */
654d8eb036bedc99e90e11910ee02d3421417697 Error!

 

There was an error!

null

java.lang.NullPointerException