MEDIUM: stream-int: add a flag indicating which side the SI is on

This new flag "SI_FL_ISBACK" is set only on the back SI and is cleared
on the front SI. That way it's possible only by looking at the SI to
know what side it is.
diff --git a/src/hlua.c b/src/hlua.c
index d106dfc..e899f08 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1999,6 +1999,7 @@
 	channel_auto_connect(&socket->s->req); /* don't wait to establish connection */
 	channel_auto_close(&socket->s->req); /* let the producer forward close requests */
 
+	socket->s->si[0].flags = SI_FL_NONE;
 	si_reset(&socket->s->si[0], socket->s->task);
 	si_set_state(&socket->s->si[0], SI_ST_EST); /* connection established (resource exists) */
 
@@ -2014,6 +2015,7 @@
 	 * and retrieve data from the server. The connection is initialized
 	 * with the "struct server".
 	 */
+	socket->s->si[1].flags = SI_FL_ISBACK;
 	si_reset(&socket->s->si[1], socket->s->task);
 	si_set_state(&socket->s->si[1], SI_ST_INI);
 	socket->s->si[1].conn_retries = socket_proxy.conn_retries;
diff --git a/src/peers.c b/src/peers.c
index 48f5fc4..d16331d 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1163,6 +1163,9 @@
 	s->be = s->fe = p;
 	s->req.buf = s->res.buf = NULL;
 
+	s->si[0].flags = SI_FL_NONE;
+	s->si[1].flags = SI_FL_ISBACK;
+
 	si_reset(&s->si[0], t);
 	si_set_state(&s->si[0], SI_ST_EST);
 
diff --git a/src/proto_http.c b/src/proto_http.c
index 30468ee..7bf80ca 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -5035,7 +5035,7 @@
 	s->req.cons->err_type  = SI_ET_NONE;
 	s->req.cons->conn_retries = 0;  /* used for logging too */
 	s->req.cons->exp       = TICK_ETERNITY;
-	s->req.cons->flags    &= SI_FL_DONT_WAKE; /* we're in the context of process_session */
+	s->req.cons->flags    &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_session */
 	s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WAKE_CONNECT|CF_WROTE_DATA);
 	s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA);
 	s->flags &= ~(SN_DIRECT|SN_ASSIGNED|SN_ADDR_SET|SN_BE_ASSIGNED|SN_FORCE_PRST|SN_IGNORE_PRST);
diff --git a/src/session.c b/src/session.c
index bb6c6e8..c06e29f 100644
--- a/src/session.c
+++ b/src/session.c
@@ -119,6 +119,9 @@
 	s->listener = l;
 	s->fe  = p;
 
+	s->si[0].flags = SI_FL_NONE;
+	s->si[1].flags = SI_FL_ISBACK;
+
 	/* On a mini-session, the connection is directly attached to the
 	 * session's target so that we don't need to initialize the stream
 	 * interfaces. Another benefit is that it's easy to detect a mini-