BUG/MEDIUM: stream: Forward the right amount of data before infinite forwarding

Before setting the infinite forward, we first forward all remaining input data
from the channel. Of course for HTX streams, this must be done using the amount
of data in the HTX message not in the channel (which appears as full because of
the HTX).
diff --git a/src/stream.c b/src/stream.c
index 941f489..eec2d0a 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2180,19 +2180,22 @@
 		channel_auto_read(req);
 		channel_auto_connect(req);
 		channel_auto_close(req);
-		c_adv(req, ci_data(req));
 
-		if (IS_HTX_STRM(s) && s->txn) {
+		if (IS_HTX_STRM(s)) {
+			struct htx *htx = htxbuf(&req->buf);
+
 			/* We'll let data flow between the producer (if still connected)
-			 * to the consumer (which might possibly not be connected yet).
+			 * to the consumer.
 			 */
+			co_set_data(req, htx->data);
 			if (!(req->flags & (CF_SHUTR|CF_SHUTW_NOW)))
-				channel_htx_forward_forever(req, htxbuf(&req->buf));
+				channel_htx_forward_forever(req, htx);
 		}
 		else {
 			/* We'll let data flow between the producer (if still connected)
 			 * to the consumer (which might possibly not be connected yet).
 			 */
+			c_adv(req, ci_data(req));
 			if (!(req->flags & (CF_SHUTR|CF_SHUTW_NOW)))
 				channel_forward_forever(req);
 
@@ -2350,20 +2353,22 @@
 		 */
 		channel_auto_read(res);
 		channel_auto_close(res);
-		c_adv(res, ci_data(res));
 
+		if (IS_HTX_STRM(s)) {
+			struct htx *htx = htxbuf(&res->buf);
 
-		if (IS_HTX_STRM(s) && s->txn) {
 			/* We'll let data flow between the producer (if still connected)
 			 * to the consumer.
 			 */
+			co_set_data(res, htx->data);
 			if (!(res->flags & (CF_SHUTR|CF_SHUTW_NOW)))
-				channel_htx_forward_forever(res, htxbuf(&res->buf));
+				channel_htx_forward_forever(res, htx);
 		}
 		else {
 			/* We'll let data flow between the producer (if still connected)
 			 * to the consumer.
 			 */
+			c_adv(res, ci_data(res));
 			if (!(res->flags & (CF_SHUTR|CF_SHUTW_NOW)))
 				channel_forward_forever(res);