MINOR: backend: make the header hash use arg_opt1 for use_domain_only
This is only a boolean extra arg. Let's map it to arg_opt1 and remove
hh_match_domain from struct proxy.
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 448b5a2..1e4115e 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -323,7 +323,6 @@
int uri_len_limit; /* character limit for uri balancing algorithm */
int uri_dirs_depth1; /* directories+1 (slashes) limit for uri balancing algorithm */
int uri_whole; /* if != 0, calculates the hash from the whole uri. Still honors the len_limit and dirs_depth1 */
- int hh_match_domain; /* toggle use of special match function */
char *capture_name; /* beginning of the name of the cookie to capture */
int capture_namelen; /* length of the cookie name to match */
int capture_len; /* length of the string to be captured */
diff --git a/src/backend.c b/src/backend.c
index 7a1acec..cc4eb97 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -394,7 +394,8 @@
* performance by avoiding bounces between servers in contexts where sessions
* are shared but cookies are not usable. If the parameter is not found, NULL
* is returned. If any server is found, it will be returned. If no valid server
- * is found, NULL is returned.
+ * is found, NULL is returned. When lbprm.arg_opt1 is set, the hash will only
+ * apply to the middle part of a domain name ("use_domain_only" option).
*/
static struct server *get_server_hh(struct stream *s, const struct server *avoid)
{
@@ -429,7 +430,7 @@
*/
len = ctx.vlen;
p = (char *)ctx.line + ctx.val;
- if (!px->hh_match_domain) {
+ if (!px->lbprm.arg_opt1) {
hash = gen_hash(px, p, len);
} else {
int dohash = 0;
@@ -1802,14 +1803,14 @@
free(curproxy->lbprm.arg_str);
curproxy->lbprm.arg_len = end - beg;
curproxy->lbprm.arg_str = my_strndup(beg, end - beg);
- curproxy->hh_match_domain = 0;
+ curproxy->lbprm.arg_opt1 = 0;
if (*args[1]) {
if (strcmp(args[1], "use_domain_only")) {
memprintf(err, "%s only accepts 'use_domain_only' modifier (got '%s').", args[0], args[1]);
return -1;
}
- curproxy->hh_match_domain = 1;
+ curproxy->lbprm.arg_opt1 = 1;
}
}
else if (!strncmp(args[0], "rdp-cookie", 10)) {
diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c
index 9774bba..cdeefd0 100644
--- a/src/cfgparse-listen.c
+++ b/src/cfgparse-listen.c
@@ -479,8 +479,6 @@
curproxy->uri_len_limit = defproxy.uri_len_limit;
curproxy->uri_dirs_depth1 = defproxy.uri_dirs_depth1;
- curproxy->hh_match_domain = defproxy.hh_match_domain;
-
if (defproxy.conn_src.iface_name)
curproxy->conn_src.iface_name = strdup(defproxy.conn_src.iface_name);
curproxy->conn_src.iface_len = defproxy.conn_src.iface_len;