MINOR: htx: Don't use end-of-data blocks anymore

This type of blocks is useless because transition between data and trailers is
obvious. And when there is no trailers, the end-of-message is still there to
know when data end for chunked messages.
diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c
index 483e703..c552337 100644
--- a/contrib/prometheus-exporter/service-prometheus.c
+++ b/contrib/prometheus-exporter/service-prometheus.c
@@ -2186,7 +2186,7 @@
 			/* fall through */
 
 		case PROMEX_ST_DONE:
-			/* Don't add EOD and TLR because mux-h1 will take care of it */
+			/* Don't add TLR because mux-h1 will take care of it */
 			if (!htx_add_endof(res_htx, HTX_BLK_EOM)) {
 				si_rx_room_blk(si);
 				goto out;
diff --git a/include/common/htx.h b/include/common/htx.h
index e2d4e15..cb998b9 100644
--- a/include/common/htx.h
+++ b/include/common/htx.h
@@ -101,10 +101,9 @@
 	HTX_BLK_HDR    =  2, /* header name/value block */
 	HTX_BLK_EOH    =  3, /* end-of-headers block */
 	HTX_BLK_DATA   =  4, /* data block */
-	HTX_BLK_EOD    =  5, /* end-of-data block */
-	HTX_BLK_TLR    =  6, /* trailer name/value block */
-	HTX_BLK_EOT    =  7, /* end-of-trailers block */
-	HTX_BLK_EOM    =  8, /* end-of-message block */
+	HTX_BLK_TLR    =  5, /* trailer name/value block */
+	HTX_BLK_EOT    =  6, /* end-of-trailers block */
+	HTX_BLK_EOM    =  7, /* end-of-message block */
 	/* 8 .. 14 unused */
 	HTX_BLK_UNUSED = 15, /* unused/removed block */
 };
@@ -756,7 +755,6 @@
 		case HTX_BLK_HDR:    return "HTX_BLK_HDR";
 		case HTX_BLK_EOH:    return "HTX_BLK_EOH";
 		case HTX_BLK_DATA:   return "HTX_BLK_DATA";
-		case HTX_BLK_EOD:    return "HTX_BLK_EOD";
 		case HTX_BLK_TLR:    return "HTX_BLK_TLR";
 		case HTX_BLK_EOT:    return "HTX_BLK_EOT";
 		case HTX_BLK_EOM:    return "HTX_BLK_EOM";
diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c
index a6612d9..13f87be 100644
--- a/src/flt_http_comp.c
+++ b/src/flt_http_comp.c
@@ -245,7 +245,6 @@
 				blk = htx_replace_blk_value(htx, blk, v, ist2(b_head(&trash), b_data(&trash)));
 				break;
 
-			case HTX_BLK_EOD:
 			case HTX_BLK_TLR:
 			case HTX_BLK_EOT:
 			case HTX_BLK_EOM:
diff --git a/src/hlua.c b/src/hlua.c
index a3fd57b..ef79632 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4002,7 +4002,7 @@
 			struct htx_blk *blk = htx_get_blk(htx, pos);
 			enum htx_blk_type type = htx_get_blk_type(blk);
 
-			if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
+			if (type == HTX_BLK_EOM || type == HTX_BLK_TLR || type == HTX_BLK_EOT)
 				break;
 			if (type == HTX_BLK_DATA)
 				len += htx_get_blksz(blk);
@@ -4251,7 +4251,6 @@
 				luaL_addlstring(&appctx->b, v.ptr, vlen);
 				break;
 
-			case HTX_BLK_EOD:
 			case HTX_BLK_TLR:
 			case HTX_BLK_EOM:
 				stop = 1;
@@ -4401,7 +4400,6 @@
 				luaL_addlstring(&appctx->b, v.ptr, vlen);
 				break;
 
-			case HTX_BLK_EOD:
 			case HTX_BLK_TLR:
 			case HTX_BLK_EOM:
 				len = 0;
@@ -7295,7 +7293,7 @@
 		if (!(ctx->ctx.hlua_apphttp.flags & APPLET_HDR_SENT))
 			goto error;
 
-		/* Don't add EOD and TLR because mux-h1 will take care of it */
+		/* Don't add TLR because mux-h1 will take care of it */
 		if (!htx_add_endof(res_htx, HTX_BLK_EOM)) {
 			si_rx_room_blk(si);
 			goto out;
diff --git a/src/http_fetch.c b/src/http_fetch.c
index a184f2f..0b8f267 100644
--- a/src/http_fetch.c
+++ b/src/http_fetch.c
@@ -848,7 +848,7 @@
 			struct htx_blk *blk = htx_get_blk(htx, pos);
 			enum htx_blk_type type = htx_get_blk_type(blk);
 
-			if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
+			if (type == HTX_BLK_EOM || type == HTX_BLK_TLR || type == HTX_BLK_EOT)
 				break;
 			if (type == HTX_BLK_DATA) {
 				if (!htx_data_to_h1(htx_get_blk_value(htx, blk), temp, 0))
@@ -919,7 +919,7 @@
 			struct htx_blk *blk = htx_get_blk(htx, pos);
 			enum htx_blk_type type = htx_get_blk_type(blk);
 
-			if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
+			if (type == HTX_BLK_EOM || type == HTX_BLK_TLR || type == HTX_BLK_EOT)
 				break;
 			if (type == HTX_BLK_DATA)
 				len += htx_get_blksz(blk);
@@ -967,7 +967,7 @@
 			struct htx_blk *blk = htx_get_blk(htx, pos);
 			enum htx_blk_type type = htx_get_blk_type(blk);
 
-			if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
+			if (type == HTX_BLK_EOM || type == HTX_BLK_TLR || type == HTX_BLK_EOT)
 				break;
 			if (type == HTX_BLK_DATA)
 				len += htx_get_blksz(blk);
@@ -2594,7 +2594,7 @@
 				struct htx_blk   *blk  = htx_get_blk(htx, pos);
 				enum htx_blk_type type = htx_get_blk_type(blk);
 
-				if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
+				if (type == HTX_BLK_EOM || type == HTX_BLK_TLR || type == HTX_BLK_EOT)
 					break;
 				if (type == HTX_BLK_DATA) {
 					if (!htx_data_to_h1(htx_get_blk_value(htx, blk), temp, 0))
diff --git a/src/htx.c b/src/htx.c
index 2fdebd0..8be38d6 100644
--- a/src/htx.c
+++ b/src/htx.c
@@ -482,7 +482,7 @@
 }
 
 /* Transfer HTX blocks from <src> to <dst>, stopping on the first block of the
- * type <mark> (typically EOH, EOD or EOM) or when <count> bytes were moved
+ * type <mark> (typically EOH or EOM) or when <count> bytes were moved
  * (including payload and meta-data). It returns the number of bytes moved and
  * the last HTX block inserted in <dst>.
  */
@@ -781,7 +781,7 @@
 	return htx_add_endof(htx, HTX_BLK_EOT);
 }
 
-/* Adds an HTX block of type EOH,EOD or EOM in <htx>. It returns the new block
+/* Adds an HTX block of type EOH or EOM in <htx>. It returns the new block
  * on success. Otherwise, it returns NULL.
  */
 struct htx_blk *htx_add_endof(struct htx *htx, enum htx_blk_type type)
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 9d6aaf2..47a4071 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -1215,14 +1215,7 @@
 				ret = h1_parse_chunk_size(buf, *ofs, b_data(buf), &chksz);
 				if (ret <= 0)
 					goto end;
-				if (!chksz) {
-					if (max < sizeof(struct htx_blk) + 1 || !htx_add_endof(htx, HTX_BLK_EOD))
-						goto end;
-					h1m->state = H1_MSG_TRAILERS;
-					max -= sizeof(struct htx_blk) + 1;
-				}
-				else
-					h1m->state = H1_MSG_DATA;
+				h1m->state = ((!chksz) ? H1_MSG_TRAILERS : H1_MSG_DATA);
 
 				h1m->curr_len  = chksz;
 				h1m->body_len += chksz;
@@ -1695,8 +1688,6 @@
 					}
 					goto done;
 				}
-				else if (type == HTX_BLK_EOD)
-					break;
 				else if (type == HTX_BLK_EOT || type == HTX_BLK_TLR) {
 					if (!chunk_memcat(tmp, "0\r\n", 3))
 						goto copy;
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 2eb4ad4..65cefa4 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -3734,13 +3734,12 @@
 		goto fail;
 	}
 
-	/* Trailers terminate a DATA sequence. In HTX we have to emit an EOD
-	 * block, and when using chunks we must send the 0 CRLF marker. For
-	 * other modes, the trailers are silently dropped.
+	/* Trailers terminate a DATA sequence. In HTX we always handle them. In
+	 * legacy, when using chunks, we have to emit the 0 CRLF marker first
+	 * and then handle the trailers. For other modes, the trailers are
+	 * silently dropped.
 	 */
 	if (htx) {
-		if (!htx_add_endof(htx, HTX_BLK_EOD))
-			goto fail;
 		if (h2_make_htx_trailers(list, htx) <= 0)
 			goto fail;
 	}
@@ -4860,7 +4859,7 @@
  * present in <buf>, for stream <h2s>. Returns the number of bytes sent. The
  * caller must check the stream's status to detect any error which might have
  * happened subsequently to a successful send. Returns the number of data bytes
- * consumed, or zero if nothing done. Note that EOD/EOM count for 1 byte.
+ * consumed, or zero if nothing done. Note that EOM count for 1 byte.
  */
 static size_t h2s_htx_frt_make_resp_data(struct h2s *h2s, struct buffer *buf, size_t count)
 {
@@ -4883,9 +4882,9 @@
 
 	htx = htx_from_buf(buf);
 
-	/* We only come here with HTX_BLK_DATA or HTX_BLK_EOD blocks. However,
-	 * while looping, we can meet an HTX_BLK_EOM block that we'll leave to
-	 * the caller to handle.
+	/* We only come here with HTX_BLK_DATA blocks. However, while looping,
+	 * we can meet an HTX_BLK_EOM block that we'll leave to the caller to
+	 * handle.
 	 */
 
  new_frame:
@@ -4894,21 +4893,11 @@
 
 	idx   = htx_get_head(htx);
 	blk   = htx_get_blk(htx, idx);
-	type  = htx_get_blk_type(blk); // DATA or EOD or EOM
+	type  = htx_get_blk_type(blk); // DATA or EOM
 	bsize = htx_get_blksz(blk);
 	fsize = bsize;
 
-	if (type == HTX_BLK_EOD) {
-		/* if we have an EOD, we're dealing with chunked data. We may
-		 * have a set of trailers after us that the caller will want to
-		 * deal with. Let's simply remove the EOD and return.
-		 */
-		htx_remove_blk(htx, blk);
-		total++; // EOD counts as one byte
-		count--;
-		goto end;
-	}
-	else if (type == HTX_BLK_EOM) {
+	if (type == HTX_BLK_EOM) {
 		if (h2s->flags & H2_SF_ES_SENT) {
 			/* ES already sent */
 			htx_remove_blk(htx, blk);
@@ -5542,7 +5531,6 @@
 				break;
 
 			case HTX_BLK_DATA:
-			case HTX_BLK_EOD:
 			case HTX_BLK_EOM:
 				/* all these cause the emission of a DATA frame (possibly empty).
 				 * This EOM necessarily is one before trailers, as the EOM following
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 6c51055..f52714b 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -1072,7 +1072,7 @@
 	/* Now we're in HTTP_MSG_DATA. We just need to know if all data have
 	 * been received or if the buffer is full.
 	 */
-	if (htx_get_tail_type(htx) >= HTX_BLK_EOD ||
+	if (htx_get_tail_type(htx) > HTX_BLK_DATA ||
 	    channel_htx_full(req, htx, global.tune.maxrewrite))
 		goto http_end;
 
diff --git a/src/stats.c b/src/stats.c
index 4b994b7..d40e089 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -2797,7 +2797,7 @@
 		while (blk) {
 			enum htx_blk_type type = htx_get_blk_type(blk);
 
-			if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
+			if (type == HTX_BLK_EOM || type == HTX_BLK_TLR || type == HTX_BLK_EOT)
 				break;
 			if (type == HTX_BLK_DATA) {
 				struct ist v = htx_get_blk_value(htx, blk);
@@ -3360,7 +3360,7 @@
 	}
 
 	if (appctx->st0 == STAT_HTTP_DONE) {
-		/* Don't add EOD and TLR because mux-h1 will take care of it */
+		/* Don't add TLR because mux-h1 will take care of it */
 		if (!htx_add_endof(res_htx, HTX_BLK_EOM)) {
 			si_rx_room_blk(si);
 			goto out;