MEDIUM: htx: Add the parsing of trailers of chunked messages

HTTP trailers are now parsed in the same way headers are. It means trailers are
converted to K/V blocks followed by an end-of-trailer marker. For now, to make
things simple, the type for trailer blocks are not the same than for header
blocks. But the aim is to make no difference between headers and trailers by
using the same type. Probably for the end-of marker too.
diff --git a/include/common/htx.h b/include/common/htx.h
index fd0871c..e2d4e15 100644
--- a/include/common/htx.h
+++ b/include/common/htx.h
@@ -103,7 +103,8 @@
 	HTX_BLK_DATA   =  4, /* data block */
 	HTX_BLK_EOD    =  5, /* end-of-data block */
 	HTX_BLK_TLR    =  6, /* trailer name/value block */
-	HTX_BLK_EOM    =  7, /* end-of-message block */
+	HTX_BLK_EOT    =  7, /* end-of-trailers block */
+	HTX_BLK_EOM    =  8, /* end-of-message block */
 	/* 8 .. 14 unused */
 	HTX_BLK_UNUSED = 15, /* unused/removed block */
 };
@@ -182,19 +183,19 @@
 				   const struct ist name, const struct ist value);
 
 struct htx_blk *htx_add_header(struct htx *htx, const struct ist name, const struct ist value);
+struct htx_blk *htx_add_trailer(struct htx *htx, const struct ist name, const struct ist value);
 struct htx_blk *htx_add_blk_type_size(struct htx *htx, enum htx_blk_type type, uint32_t blksz);
 struct htx_blk *htx_add_all_headers(struct htx *htx, const struct http_hdr *hdrs);
+struct htx_blk *htx_add_all_trailers(struct htx *htx, const struct http_hdr *hdrs);
 struct htx_blk *htx_add_endof(struct htx *htx, enum htx_blk_type type);
 struct htx_blk *htx_add_data_atonce(struct htx *htx, const struct ist data);
 size_t htx_add_data(struct htx *htx, const struct ist data);
-struct htx_blk *htx_add_trailer(struct htx *htx, const struct ist tlr);
 struct htx_blk *htx_add_data_before(struct htx *htx, const struct htx_blk *ref, const struct ist data);
 
 int htx_reqline_to_h1(const struct htx_sl *sl, struct buffer *chk);
 int htx_stline_to_h1(const struct htx_sl *sl, struct buffer *chk);
 int htx_hdr_to_h1(const struct ist n, const struct ist v, struct buffer *chk);
 int htx_data_to_h1(const struct ist data, struct buffer *chk, int chunked);
-int htx_trailer_to_h1(const struct ist tlr, struct buffer *chk);
 
 /* Functions and macros to get parts of the start-line or legnth of these
  * parts
@@ -299,6 +300,7 @@
 
 	switch (type) {
 		case HTX_BLK_HDR:
+		case HTX_BLK_TLR:
 			/*       name.length       +        value.length        */
 			return ((blk->info & 0xff) + ((blk->info >> 8) & 0xfffff));
 		default:
@@ -513,12 +515,12 @@
 
 	switch (type) {
 		case HTX_BLK_HDR:
+		case HTX_BLK_TLR:
 			blk->info = (type << 28) + (vlen << 8) + (blk->info & 0xff);
 			break;
 		case HTX_BLK_REQ_SL:
 		case HTX_BLK_RES_SL:
 		case HTX_BLK_DATA:
-		case HTX_BLK_TLR:
 			blk->info = (type << 28) + vlen;
 			break;
 		default:
@@ -543,6 +545,7 @@
 
 	switch (type) {
 		case HTX_BLK_HDR:
+		case HTX_BLK_TLR:
 			ret.ptr = htx_get_blk_ptr(htx, blk);
 			ret.len = blk->info & 0xff;
 			break;
@@ -564,6 +567,7 @@
 
 	switch (type) {
 		case HTX_BLK_HDR:
+		case HTX_BLK_TLR:
 			ret.ptr = htx_get_blk_ptr(htx, blk) + (blk->info & 0xff);
 			ret.len = (blk->info >> 8) & 0xfffff;
 			break;
@@ -571,7 +575,6 @@
 		case HTX_BLK_REQ_SL:
 		case HTX_BLK_RES_SL:
 		case HTX_BLK_DATA:
-		case HTX_BLK_TLR:
 			ret.ptr = htx_get_blk_ptr(htx, blk);
 			ret.len = blk->info & 0xfffffff;
 			break;
@@ -755,6 +758,7 @@
 		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";
 		case HTX_BLK_UNUSED: return "HTX_BLK_UNUSED";
 		default:             return "HTX_BLK_???";
@@ -789,7 +793,7 @@
 				HTX_SL_P2_LEN(sl), HTX_SL_P2_PTR(sl),
 				HTX_SL_P3_LEN(sl), HTX_SL_P3_PTR(sl));
 		}
-		else if (type == HTX_BLK_HDR)
+		else if (type == HTX_BLK_HDR || type == HTX_BLK_TLR)
 			fprintf(stderr, "\t\t[%u] type=%-17s - size=%-6u - addr=%-6u\t%.*s: %.*s\n",
 				pos, htx_blk_type_str(type), sz, blk->addr,
 				(int)n.len, n.ptr,