]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: backend: make the header hash use arg_opt1 for use_domain_only
authorWilly Tarreau <w@1wt.eu>
Mon, 14 Jan 2019 15:04:54 +0000 (16:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Jan 2019 18:33:17 +0000 (19:33 +0100)
This is only a boolean extra arg. Let's map it to arg_opt1 and remove
hh_match_domain from struct proxy.

include/types/proxy.h
src/backend.c
src/cfgparse-listen.c

index 448b5a2445adfd635656d253bc9f411a8c0389db..1e4115edf9b199a466582f4373aabdd6bcdbd21f 100644 (file)
@@ -323,7 +323,6 @@ struct proxy {
        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 */
index 7a1acec76c76b3d63c362dac4a07f95958320b37..cc4eb97d6b8b7f46cf923f101a9e5f1efe8f20a9 100644 (file)
@@ -394,7 +394,8 @@ static struct server *get_server_ph_post(struct stream *s, const struct server *
  * 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 @@ static struct server *get_server_hh(struct stream *s, const struct server *avoid
         */
        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 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
                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)) {
index 9774bba5f885b9c9a107733390b5301c5a3fd73a..cdeefd0a879abbf1be9e6a4836fa6f58b2ba1fe8 100644 (file)
@@ -479,8 +479,6 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        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;