| 1270 | } |
| 1271 | |
| 1272 | static char *select_random_value_part(request_rec *r, char *value) |
| 1273 | { |
| 1274 | char *p = value; |
| 1275 | unsigned n = 1; |
| 1276 | |
| 1277 | /* count number of distinct values */ |
| 1278 | while ((p = ap_strchr(p, '|')) != NULL) { |
| 1279 | ++n; |
| 1280 | ++p; |
| 1281 | } |
| 1282 | |
| 1283 | if (n > 1) { |
| 1284 | n = ap_random_pick(1, n); |
| 1285 | |
| 1286 | /* extract it from the whole string */ |
| 1287 | while (--n && (value = ap_strchr(value, '|')) != NULL) { |
| 1288 | ++value; |
| 1289 | } |
| 1290 | |
| 1291 | if (value) { /* should not be NULL, but ... */ |
| 1292 | p = ap_strchr(value, '|'); |
| 1293 | if (p) { |
| 1294 | *p = '\0'; |
| 1295 | } |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | return value; |
| 1300 | } |
| 1301 | |
| 1302 | /* child process code */ |
| 1303 | static void rewrite_child_errfn(apr_pool_t *p, apr_status_t err, |
no test coverage detected