MCPcopy Create free account
hub / github.com/apache/httpd / add_cache_enable

Function add_cache_enable

modules/cache/mod_cache.c:2229–2284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2227}
2228
2229static const char *add_cache_enable(cmd_parms *parms, void *dummy,
2230 const char *type,
2231 const char *url)
2232{
2233 cache_dir_conf *dconf = (cache_dir_conf *)dummy;
2234 cache_server_conf *conf;
2235 struct cache_enable *new;
2236
2237 const char *err = ap_check_cmd_context(parms,
2238 NOT_IN_DIRECTORY|NOT_IN_LIMIT|NOT_IN_FILES);
2239 if (err != NULL) {
2240 return err;
2241 }
2242
2243 if (*type == '/') {
2244 return apr_psprintf(parms->pool,
2245 "provider (%s) starts with a '/'. Are url and provider switched?",
2246 type);
2247 }
2248
2249 if (!url) {
2250 url = parms->path;
2251 }
2252 if (!url) {
2253 return apr_psprintf(parms->pool,
2254 "CacheEnable provider (%s) is missing an URL.", type);
2255 }
2256 if (parms->path && strncmp(parms->path, url, strlen(parms->path))) {
2257 return "When in a Location, CacheEnable must specify a path or an URL below "
2258 "that location.";
2259 }
2260
2261 conf =
2262 (cache_server_conf *)ap_get_module_config(parms->server->module_config,
2263 &cache_module);
2264
2265 if (parms->path) {
2266 new = apr_array_push(dconf->cacheenable);
2267 dconf->enable_set = 1;
2268 }
2269 else {
2270 new = apr_array_push(conf->cacheenable);
2271 }
2272
2273 new->type = type;
2274 if (apr_uri_parse(parms->pool, url, &(new->url))) {
2275 return NULL;
2276 }
2277 if (new->url.path) {
2278 new->pathlen = strlen(new->url.path);
2279 } else {
2280 new->pathlen = 1;
2281 new->url.path = "/";
2282 }
2283 return NULL;
2284}
2285
2286static const char *add_cache_disable(cmd_parms *parms, void *dummy,

Callers

nothing calls this directly

Calls 2

ap_check_cmd_contextFunction · 0.85
ap_get_module_configFunction · 0.85

Tested by

no test coverage detected