[BUG] log: retrieve the target from the session, not the SI

Since we now have the copy of the target in the session, use it instead
of relying on the SI for it. The SI drops the target upon unregister()
so applets such as stats were logged as "NOSRV".
diff --git a/src/backend.c b/src/backend.c
index 397216d..4b923a7 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -969,6 +969,7 @@
 	 */
 	stream_sock_prepare_interface(s->req->cons);
 	s->req->cons->connect = tcp_connect_server;
+	/* the target was only on the session, assign it to the SI now */
 	copy_target(&s->req->cons->target, &s->target);
 
 	/* process the case where the server requires the PROXY protocol to be sent */
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 34f0901..6c12a18 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -107,6 +107,7 @@
 {
 	/* we have a dedicated I/O handler for the stats */
 	stream_int_register_handler(&s->si[1], &cli_applet);
+	copy_target(&s->target, &s->si[1].target); // for logging only
 	s->si[1].applet.private = s;
 	s->si[1].applet.st1 = 0;
 	s->si[1].applet.st0 = STAT_CLI_INIT;
diff --git a/src/log.c b/src/log.c
index f90ec90..f70b38e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -352,12 +352,12 @@
 
 	if (!(tolog & LW_SVID))
 		svid = "-";
-	else switch (s->req->cons->target.type) {
+	else switch (s->target.type) {
 	case TARG_TYPE_SERVER:
-		svid = s->req->cons->target.ptr.s->id;
+		svid = s->target.ptr.s->id;
 		break;
 	case TARG_TYPE_APPLET:
-		svid = s->req->cons->target.ptr.a->name;
+		svid = s->target.ptr.a->name;
 		break;
 	default:
 		svid = "<NOSRV>";
diff --git a/src/peers.c b/src/peers.c
index 739c09b..0274483 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1078,6 +1078,7 @@
 {
 	 /* we have a dedicated I/O handler for the stats */
 	stream_int_register_handler(&s->si[1], &peer_applet);
+	copy_target(&s->target, &s->si[1].target); // for logging only
 	s->si[1].release = peer_session_release;
 	s->si[1].applet.private = s;
 	s->si[1].applet.st0 = PEER_SESSION_ACCEPT;
diff --git a/src/proto_http.c b/src/proto_http.c
index ef6f46e..c00aced 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -948,12 +948,12 @@
 
 	if (!(tolog & LW_SVID))
 		svid = "-";
-	else switch (s->req->cons->target.type) {
+	else switch (s->target.type) {
 	case TARG_TYPE_SERVER:
-		svid = s->req->cons->target.ptr.s->id;
+		svid = s->target.ptr.s->id;
 		break;
 	case TARG_TYPE_APPLET:
-		svid = s->req->cons->target.ptr.a->name;
+		svid = s->target.ptr.a->name;
 		break;
 	default:
 		svid = "<NOSRV>";
@@ -1171,12 +1171,12 @@
 
 	if (!(tolog & LW_SVID))
 		svid = "-";
-	else switch (s->req->cons->target.type) {
+	else switch (s->target.type) {
 	case TARG_TYPE_SERVER:
-		svid = s->req->cons->target.ptr.s->id;
+		svid = s->target.ptr.s->id;
 		break;
 	case TARG_TYPE_APPLET:
-		svid = s->req->cons->target.ptr.a->name;
+		svid = s->target.ptr.a->name;
 		break;
 	default:
 		svid = "<NOSRV>";
@@ -3278,6 +3278,7 @@
 		s->logs.tv_request = now;
 		s->task->nice = -32; /* small boost for HTTP statistics */
 		stream_int_register_handler(s->rep->prod, &http_stats_applet);
+		copy_target(&s->target, &s->rep->prod->target); // for logging only
 		s->rep->prod->applet.private = s;
 		s->rep->prod->applet.st0 = s->rep->prod->applet.st1 = 0;
 		req->analysers = 0;