[MINOR] add configuration support for "redir" server keyword

The servers now support the "redir" keyword, making it possible to
return a 302 with the specified prefix in front of the request instead
of connecting to them. This is generally useful for multi-site load
balancing but may also serve in order to achieve very high traffic
rate.

The keyword has only been added to the config parser and to structures,
it's not used yet.
diff --git a/include/types/server.h b/include/types/server.h
index cfc4d7d..c93236c 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -2,7 +2,7 @@
   include/types/server.h
   This file defines everything related to servers.
 
-  Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
+  Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
   
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -73,7 +73,9 @@
 	int state;				/* server state (SRV_*) */
 	int prev_state;				/* server state before last change (SRV_*) */
 	int  cklen;				/* the len of the cookie, to speed up checks */
+	int rdr_len;				/* the length of the redirection prefix */
 	char *cookie;				/* the id set in the cookie */
+	char *rdr_pfx;				/* the redirection prefix */
 
 	struct proxy *proxy;			/* the proxy this server belongs to */
 	int cur_sess, cur_sess_max;		/* number of currently active sessions (including syn_sent) */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 1815ed4..9329df3 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1547,6 +1547,11 @@
 				newsrv->cklen = strlen(args[cur_arg + 1]);
 				cur_arg += 2;
 			}
+			else if (!strcmp(args[cur_arg], "redir")) {
+				newsrv->rdr_pfx = strdup(args[cur_arg + 1]);
+				newsrv->rdr_len = strlen(args[cur_arg + 1]);
+				cur_arg += 2;
+			}
 			else if (!strcmp(args[cur_arg], "rise")) {
 				newsrv->rise = atol(args[cur_arg + 1]);
 				newsrv->health = newsrv->rise;
@@ -1691,7 +1696,7 @@
 				return -1;
 			}
 			else {
-				Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'check', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'addr', 'port', 'source', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",
+				Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'redir', 'check', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'addr', 'port', 'source', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",
 				      file, linenum, newsrv->id);
 				return -1;
 			}
@@ -2905,6 +2910,19 @@
 			curproxy->to_log &= ~LW_BYTES;
 
 		/*
+		 * ensure that we're not cross-dressing a TCP server into HTTP.
+		 */
+		newsrv = curproxy->srv;
+		while (newsrv != NULL) {
+			if ((curproxy->mode != PR_MODE_HTTP) && (newsrv->rdr_len || newsrv->cklen)) {
+				Alert("parsing %s, %s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n",
+				      file, proxy_type_str(curproxy), curproxy->id, linenum);
+				goto err;
+			}
+			newsrv = newsrv->next;
+		}
+
+		/*
 		 * If this server supports a maxconn parameter, it needs a dedicated
 		 * tasks to fill the emptied slots when a connection leaves.
 		 */