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

Function set_hc_condition

modules/proxy/mod_proxy_hcheck.c:234–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234static const char *set_hc_condition(cmd_parms *cmd, void *dummy, const char *arg)
235{
236 char *name = NULL;
237 char *expr;
238 sctx_t *ctx;
239 hc_condition_t *cond;
240
241 const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
242 if (err)
243 return err;
244 ctx = (sctx_t *) ap_get_module_config(cmd->server->module_config,
245 &proxy_hcheck_module);
246
247 name = ap_getword_conf(cmd->pool, &arg);
248 if (!*name) {
249 return apr_pstrcat(cmd->temp_pool, "Missing expression name for ",
250 cmd->cmd->name, NULL);
251 }
252 if (strlen(name) > (PROXY_WORKER_MAX_SCHEME_SIZE - 1)) {
253 return apr_psprintf(cmd->temp_pool, "Expression name limited to %d characters",
254 (PROXY_WORKER_MAX_SCHEME_SIZE - 1));
255 }
256 /* get expr. Allow fancy new {...} quoting style */
257 expr = ap_getword_conf2(cmd->temp_pool, &arg);
258 if (!*expr) {
259 return apr_pstrcat(cmd->temp_pool, "Missing expression for ",
260 cmd->cmd->name, NULL);
261 }
262 cond = apr_palloc(cmd->pool, sizeof(hc_condition_t));
263 cond->pexpr = ap_expr_parse_cmd(cmd, expr, 0, &err, NULL);
264 if (err) {
265 return apr_psprintf(cmd->temp_pool, "Could not parse expression \"%s\": %s",
266 expr, err);
267 }
268 cond->expr = apr_pstrdup(cmd->pool, expr);
269 apr_table_setn(ctx->conditions, name, (void *)cond);
270 expr = ap_getword_conf(cmd->temp_pool, &arg);
271 if (*expr) {
272 return "error: extra parameter(s)";
273 }
274 return NULL;
275}
276
277static const char *set_hc_template(cmd_parms *cmd, void *dummy, const char *arg)
278{

Callers

nothing calls this directly

Calls 4

ap_check_cmd_contextFunction · 0.85
ap_get_module_configFunction · 0.85
ap_getword_confFunction · 0.85
ap_getword_conf2Function · 0.85

Tested by

no test coverage detected