mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-07 09:42:34 +00:00
MINOR: config: add new setting "http-reuse"
For now it only supports "never", meaning that we never want to reuse a shared connection, and "always", meaning that we can use any connection that was not marked private. When "never" is set, this also implies that no idle connection may become a shared one.
This commit is contained in:
parent
387ebf84dd
commit
d8fecee291
@ -76,7 +76,15 @@ enum pr_mode {
|
|||||||
/* bits for proxy->options */
|
/* bits for proxy->options */
|
||||||
#define PR_O_REDISP 0x00000001 /* allow reconnection to dispatch in case of errors */
|
#define PR_O_REDISP 0x00000001 /* allow reconnection to dispatch in case of errors */
|
||||||
#define PR_O_TRANSP 0x00000002 /* transparent mode : use original DEST as dispatch */
|
#define PR_O_TRANSP 0x00000002 /* transparent mode : use original DEST as dispatch */
|
||||||
/* unused: 0x04, 0x08, 0x10 */
|
|
||||||
|
/* HTTP server-side reuse */
|
||||||
|
#define PR_O_REUSE_NEVR 0x00000000 /* never reuse a shared connection */
|
||||||
|
#define PR_O_REUSE_SAFE 0x00000004 /* only reuse a shared connection when it's safe to do so */
|
||||||
|
#define PR_O_REUSE_AGGR 0x00000008 /* aggressively reuse a shared connection */
|
||||||
|
#define PR_O_REUSE_ALWS 0x0000000C /* always reuse a shared connection */
|
||||||
|
#define PR_O_REUSE_MASK 0x0000000C /* mask to retrieve shared connection preferences */
|
||||||
|
|
||||||
|
/* unused: 0x10 */
|
||||||
#define PR_O_PREF_LAST 0x00000020 /* prefer last server */
|
#define PR_O_PREF_LAST 0x00000020 /* prefer last server */
|
||||||
#define PR_O_DISPATCH 0x00000040 /* use dispatch mode */
|
#define PR_O_DISPATCH 0x00000040 /* use dispatch mode */
|
||||||
#define PR_O_FORCED_ID 0x00000080 /* proxy's ID was forced in the configuration */
|
#define PR_O_FORCED_ID 0x00000080 /* proxy's ID was forced in the configuration */
|
||||||
|
@ -5024,6 +5024,30 @@ stats_error_parsing:
|
|||||||
if (alertif_too_many_args_idx(1, 0, file, linenum, args, &err_code))
|
if (alertif_too_many_args_idx(1, 0, file, linenum, args, &err_code))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(args[0], "http-reuse")) {
|
||||||
|
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
|
||||||
|
err_code |= ERR_WARN;
|
||||||
|
|
||||||
|
if (strcmp(args[1], "never") == 0) {
|
||||||
|
/* enable a graceful server shutdown on an HTTP 404 response */
|
||||||
|
curproxy->options &= ~PR_O_REUSE_MASK;
|
||||||
|
curproxy->options |= PR_O_REUSE_NEVR;
|
||||||
|
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
else if (strcmp(args[1], "always") == 0) {
|
||||||
|
/* enable a graceful server shutdown on an HTTP 404 response */
|
||||||
|
curproxy->options &= ~PR_O_REUSE_MASK;
|
||||||
|
curproxy->options |= PR_O_REUSE_ALWS;
|
||||||
|
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Alert("parsing [%s:%d] : '%s' only supports 'never', 'always'.\n", file, linenum, args[0]);
|
||||||
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!strcmp(args[0], "http-check")) {
|
else if (!strcmp(args[0], "http-check")) {
|
||||||
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
|
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
|
||||||
err_code |= ERR_WARN;
|
err_code |= ERR_WARN;
|
||||||
|
Loading…
Reference in New Issue
Block a user