BUG/MINOR: lua/htx: Don't forget to call htx_to_buf() when appropriate

When htx_from_buf() is used to get an HTX message from a buffer, htx_to_buf()
must always be called when finish. Some calls to htx_to_buf() were missing.

This patch must be backported to 1.9.
diff --git a/src/hlua.c b/src/hlua.c
index dd5a2c2..c95eb37 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4215,9 +4215,11 @@
 	data = htx->data - co_data(res);
 	channel_add_input(res, data);
 	appctx->appctx->ctx.hlua_apphttp.flags &= ~APPLET_100C;
+	htx_to_buf(htx, &res->buf);
 	return;
 
   fail:
+	htx_to_buf(htx, &res->buf);
 	hlua_pusherror(L, "Lua applet http '%s': Failed to create 100-Continue response.\n",
 		       appctx->appctx->rule->arg.hlua_rule->fcn.name);
 	WILL_LJMP(lua_error(L));
@@ -4300,6 +4302,7 @@
 		}
 	}
 
+	htx_to_buf(htx, &req->buf);
 	if (!stop) {
 		si_cant_get(si);
 		MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_htx_getline_yield, TICK_ETERNITY, 0));
@@ -4472,6 +4475,8 @@
 		}
 	}
 
+	htx_to_buf(htx, &req->buf);
+
 	/* If we are no other data available, yield waiting for new data. */
 	if (len) {
 		if (len > 0) {
@@ -4634,7 +4639,6 @@
 	/* Copy data. */
 	if (!htx_add_data(htx, ist2(data + l, max)))
 		goto snd_yield;
-	htx_to_buf(htx, &res->buf);
 	channel_add_input(res, max);
 
 	/* update counters. */
@@ -4647,10 +4651,12 @@
 	 */
 	if (l < len) {
 	  snd_yield:
+		htx_to_buf(htx, &res->buf);
 		si_rx_room_blk(si);
 		MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_htx_send_yield, TICK_ETERNITY, 0));
 	}
 
+	htx_to_buf(htx, &res->buf);
 	return 1;
 }
 
@@ -7318,6 +7324,7 @@
 
 			if (sz > count) {
 				si_cant_get(si);
+				htx_to_buf(req_htx, &req->buf);
 				goto out;
 			}
 
@@ -7328,6 +7335,7 @@
 			if (type == HTX_BLK_EOH)
 				break;
 		}
+		htx_to_buf(req_htx, &req->buf);
 	}
 
 	/* Executes The applet if it is not done. */