[MINOR] add X-Original-To: header

I have attached a patch which will add on every http request a new
header 'X-Original-To'. If you have HAProxy running in transparent mode
with a big number of SQUID servers behind it, it is very nice to have
the original destination ip as a common header to make decisions based
on it.

The whole thing is configurable with a new option 'originalto'. I have
updated the sourcecode as well as the documentation. The 'haproxy-en.txt'
and 'haproxy-fr.txt' files are untouched, due to lack of my french
language knowledge. ;)

Also the patch adds this header for IPv4 only. I haven't any IPv6 test
environment running here and don't know if getsockopt() with SO_ORIGINAL_DST
will work on IPv6. If someone knows it and wants to test it I can modify
the diff. Feel free to ask me questions or things which should be changed. :)

--Maik
diff --git a/include/common/defaults.h b/include/common/defaults.h
index fb8d188..07cb75f 100644
--- a/include/common/defaults.h
+++ b/include/common/defaults.h
@@ -130,6 +130,9 @@
 // X-Forwarded-For header default
 #define DEF_XFORWARDFOR_HDR	"X-Forwarded-For"
 
+// X-Original-To header default
+#define DEF_XORIGINALTO_HDR	"X-Original-To"
+
 /* Default connections limit.
  *
  * A system limit can be enforced at build time in order to avoid using haproxy
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 71a5230..924019c 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -105,7 +105,8 @@
 #define PR_O_CONTSTATS	0x10000000	/* continous counters */
 #define PR_O_HTTP_PROXY 0x20000000	/* Enable session to use HTTP proxy operations */
 #define PR_O_DISABLE404 0x40000000      /* Disable a server on a 404 response to a health-check */
-/* unused: 0x80000000 */
+#define PR_O_ORGTO      0x80000000      /* insert x-original-to with destination address */
+/* unused: 0x80000000 - now used by PR_O_ORGTO */
 
 /* bits for proxy->options2 */
 #define PR_O2_SPLIC_REQ	0x00000001      /* transfer requests using linux kernel's splice() */
@@ -231,8 +232,12 @@
 	unsigned int fe_maxsps;			/* max # of new sessions per second on the frontend */
 	unsigned int fullconn;			/* #conns on backend above which servers are used at full load */
 	struct in_addr except_net, except_mask; /* don't x-forward-for for this address. FIXME: should support IPv6 */
+	struct in_addr except_to;		/* don't x-original-to for this address. */
+	struct in_addr except_mask_to;		/* the netmask for except_to. */
 	char *fwdfor_hdr_name;			/* header to use - default: "x-forwarded-for" */
 	int fwdfor_hdr_len;			/* length of "x-forwarded-for" header */
+	char *orgto_hdr_name;			/* header to use - default: "x-original-to" */
+	int orgto_hdr_len;			/* length of "x-original-to" header */
 
 	unsigned down_trans;			/* up-down transitions */
 	unsigned down_time;			/* total time the proxy was down */