[MEDIUM] log: take the logged server name from the stream interface

With HTTP keep-alive, logging the right server name will be quite
complex because the assigned server will possibly change before we log.
Also, when we want to log accesses to an applet, it's not easy because
the applet becomes NULL again before logging.

The logged server's name is now taken from the target stored in the
stream interface. That way we can log an applet, a server name, or we
could even log a proxy or anything else if we wanted to. Ideally the
session should contain a desired target which is the one which should
be logged.
diff --git a/src/proto_http.c b/src/proto_http.c
index 9693ad8..7830580 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -855,7 +855,7 @@
 	struct http_txn *txn = &s->txn;
 	int tolog, level, err;
 	char *uri, *h;
-	char *svid;
+	const char *svid;
 	struct tm tm;
 	static char tmpline[MAX_SYSLOG_LEN];
 	int hdr;
@@ -943,9 +943,19 @@
 	h += w;
 	*(h++) = '\"';
 
-	svid = (tolog & LW_SVID) ?
-		(s->data_source != DATA_SRC_STATS) ?
-		(s->srv != NULL) ? s->srv->id : "<NOSRV>" : "<STATS>" : "-";
+	if (!(tolog & LW_SVID))
+		svid = "-";
+	else switch (s->req->cons->target.type) {
+	case TARG_TYPE_SERVER:
+		svid = s->req->cons->target.ptr.s->id;
+		break;
+	case TARG_TYPE_APPLET:
+		svid = s->req->cons->target.ptr.a->name;
+		break;
+	default:
+		svid = "<NOSRV>";
+		break;
+	}
 
 	w = strlen(svid);
 	if (h >= tmpline + sizeof(tmpline) - 4 - w)
@@ -1081,7 +1091,7 @@
 	struct http_txn *txn = &s->txn;
 	int tolog, level, err;
 	char *uri, *h;
-	char *svid;
+	const char *svid;
 	struct tm tm;
 	static char tmpline[MAX_SYSLOG_LEN];
 	int t_request;
@@ -1156,9 +1166,19 @@
 	}
 	*h = '\0';
 
-	svid = (tolog & LW_SVID) ?
-		(s->data_source != DATA_SRC_STATS) ?
-		(s->srv != NULL) ? s->srv->id : "<NOSRV>" : "<STATS>" : "-";
+	if (!(tolog & LW_SVID))
+		svid = "-";
+	else switch (s->req->cons->target.type) {
+	case TARG_TYPE_SERVER:
+		svid = s->req->cons->target.ptr.s->id;
+		break;
+	case TARG_TYPE_APPLET:
+		svid = s->req->cons->target.ptr.a->name;
+		break;
+	default:
+		svid = "<NOSRV>";
+		break;
+	}
 
 	t_request = -1;
 	if (tv_isge(&s->logs.tv_request, &s->logs.tv_accept))