BUG/MEDIUM: http: the "unique-id" sample fetch could crash without a steeam

Since commit 5f940703b3 ("MINOR: log: Don't depends on a stream to process
samples in log-format string") it has become quite obvious that a few sample
fetch functions and converters were still heavily dependent on the presence
of a stream without testing for it.

The unique-id sample fetch function, if called without a stream, will result
in a crash.

This fix adds a check for the stream's existence, and should be backported
to all stable versions up to 1.7.

(cherry picked from commit a1062a4de8ba300979cc380b69b284f86dc13853)
[wt: adjusted ctx: unique_id was a ptr not an ist in 2.1]
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit c000f0d1e1228dd64a00538a387e7de3290b0860)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/http_fetch.c b/src/http_fetch.c
index e8c5e55..487333d 100644
--- a/src/http_fetch.c
+++ b/src/http_fetch.c
@@ -612,6 +612,9 @@
 	if (LIST_ISEMPTY(&smp->sess->fe->format_unique_id))
 		return 0;
 
+	if (!smp->strm)
+		return 0;
+
 	if (!smp->strm->unique_id) {
 		if ((smp->strm->unique_id = pool_alloc(pool_head_uniqueid)) == NULL)
 			return 0;