MEDIUM: session: implement the "use-server" directive

Sometimes it is desirable to forward a particular request to a specific
server without having to declare a dedicated backend for this server. This
can be achieved using the "use-server" rules. These rules are evaluated after
the "redirect" rules and before evaluating cookies, and they have precedence
on them. There may be as many "use-server" rules as desired. All of these
rules are evaluated in their declaration order, and the first one which
matches will assign the server.
diff --git a/include/types/buffers.h b/include/types/buffers.h
index 42e2a56..6280c4f 100644
--- a/include/types/buffers.h
+++ b/include/types/buffers.h
@@ -144,12 +144,13 @@
 #define AN_REQ_SWITCHING_RULES  0x00000010  /* apply the switching rules */
 #define AN_REQ_INSPECT_BE       0x00000020  /* inspect request contents in the backend */
 #define AN_REQ_HTTP_PROCESS_BE  0x00000040  /* process the backend's HTTP part */
-#define AN_REQ_HTTP_INNER       0x00000080  /* inner processing of HTTP request */
-#define AN_REQ_HTTP_TARPIT      0x00000100  /* wait for end of HTTP tarpit */
-#define AN_REQ_HTTP_BODY        0x00000200  /* inspect HTTP request body */
-#define AN_REQ_STICKING_RULES   0x00000400  /* table persistence matching */
-#define AN_REQ_PRST_RDP_COOKIE  0x00000800  /* persistence on rdp cookie */
-#define AN_REQ_HTTP_XFER_BODY   0x00001000  /* forward request body */
+#define AN_REQ_SRV_RULES        0x00000080  /* use-server rules */
+#define AN_REQ_HTTP_INNER       0x00000100  /* inner processing of HTTP request */
+#define AN_REQ_HTTP_TARPIT      0x00000200  /* wait for end of HTTP tarpit */
+#define AN_REQ_HTTP_BODY        0x00000400  /* inspect HTTP request body */
+#define AN_REQ_STICKING_RULES   0x00000800  /* table persistence matching */
+#define AN_REQ_PRST_RDP_COOKIE  0x00001000  /* persistence on rdp cookie */
+#define AN_REQ_HTTP_XFER_BODY   0x00002000  /* forward request body */
 
 /* response analysers */
 #define AN_RES_INSPECT          0x00010000  /* content inspection */
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 26cdfe4..d69a914 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -205,6 +205,7 @@
 	struct list persist_rules;		/* 'force-persist' and 'ignore-persist' rules (chained) */
 	struct list sticking_rules;             /* content sticking rules (chained) */
 	struct list storersp_rules;             /* content store response rules (chained) */
+	struct list server_rules;               /* server switching rules (chained) */
 	struct {                                /* TCP request processing */
 		unsigned int inspect_delay;     /* inspection delay */
 		struct list inspect_rules;      /* inspection rules */
@@ -350,6 +351,15 @@
 	} be;
 };
 
+struct server_rule {
+	struct list list;			/* list linked to from the proxy */
+	struct acl_cond *cond;			/* acl condition to meet */
+	union {
+		struct server *ptr;		/* target server */
+		char *name;			/* target server name during config parsing */
+	} srv;
+};
+
 struct persist_rule {
 	struct list list;			/* list linked to from the proxy */
 	struct acl_cond *cond;			/* acl condition to meet */