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

Function run_rewritemap_programs

modules/mappers/mod_rewrite.c:1351–1396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349}
1350
1351static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p)
1352{
1353 rewrite_server_conf *conf;
1354 apr_hash_index_t *hi;
1355 apr_status_t rc;
1356
1357 conf = ap_get_module_config(s->module_config, &rewrite_module);
1358
1359 /* If the engine isn't turned on,
1360 * don't even try to do anything.
1361 */
1362 if (conf->state == ENGINE_DISABLED) {
1363 return APR_SUCCESS;
1364 }
1365
1366 for (hi = apr_hash_first(p, conf->rewritemaps); hi; hi = apr_hash_next(hi)){
1367 apr_file_t *fpin = NULL;
1368 apr_file_t *fpout = NULL;
1369 rewritemap_entry *map;
1370 void *val;
1371
1372 apr_hash_this(hi, NULL, NULL, &val);
1373 map = val;
1374
1375 if (map->type != MAPTYPE_PRG) {
1376 continue;
1377 }
1378 if (!(map->argv[0]) || !*(map->argv[0]) || map->fpin || map->fpout) {
1379 continue;
1380 }
1381
1382 rc = rewritemap_program_child(p, map->argv[0], map->argv,
1383 map->user, map->group,
1384 &fpout, &fpin);
1385 if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) {
1386 ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, APLOGNO(00654)
1387 "mod_rewrite: could not start RewriteMap "
1388 "program %s", map->checkfile);
1389 return rc;
1390 }
1391 map->fpin = fpin;
1392 map->fpout = fpout;
1393 }
1394
1395 return APR_SUCCESS;
1396}
1397
1398
1399/*

Callers 1

post_configFunction · 0.85

Calls 3

ap_get_module_configFunction · 0.85
rewritemap_program_childFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected