MINOR: config: disable header captures in TCP mode and complain

In order to help users fix their configs, report a warning when a capture
has been set on a non-HTTP frontend.

This should be backported to 1.4.
This commit is contained in:
Willy Tarreau 2012-03-24 08:33:05 +01:00
parent 42f7d89156
commit 9a54e13788

View File

@ -6062,14 +6062,33 @@ out_uri_auth_compat:
} }
/* The small pools required for the capture lists */ /* The small pools required for the capture lists */
if (curproxy->nb_req_cap) if (curproxy->nb_req_cap) {
curproxy->req_cap_pool = create_pool("ptrcap", if (curproxy->mode == PR_MODE_HTTP) {
curproxy->nb_req_cap * sizeof(char *), curproxy->req_cap_pool = create_pool("ptrcap",
MEM_F_SHARED); curproxy->nb_req_cap * sizeof(char *),
if (curproxy->nb_rsp_cap) MEM_F_SHARED);
curproxy->rsp_cap_pool = create_pool("ptrcap", } else {
curproxy->nb_rsp_cap * sizeof(char *), Warning("config : 'capture request header' ignored for %s '%s' as it requires HTTP mode.\n",
MEM_F_SHARED); proxy_type_str(curproxy), curproxy->id);
err_code |= ERR_WARN;
curproxy->to_log &= ~LW_REQHDR;
curproxy->nb_req_cap = 0;
}
}
if (curproxy->nb_rsp_cap) {
if (curproxy->mode == PR_MODE_HTTP) {
curproxy->rsp_cap_pool = create_pool("ptrcap",
curproxy->nb_rsp_cap * sizeof(char *),
MEM_F_SHARED);
} else {
Warning("config : 'capture response header' ignored for %s '%s' as it requires HTTP mode.\n",
proxy_type_str(curproxy), curproxy->id);
err_code |= ERR_WARN;
curproxy->to_log &= ~LW_REQHDR;
curproxy->nb_rsp_cap = 0;
}
}
/* first, we will invert the servers list order */ /* first, we will invert the servers list order */
newsrv = NULL; newsrv = NULL;