MEDIUM: htx: Store the first block position instead of the start-line one

We don't store the start-line position anymore in the HTX message. Instead we
store the first block position to analyze. For now, it is almost the same. But
once all changes will be made on this part, this position will have to be used
by HTX analyzers, and only in the analysis context, to know where the analyse
should start.

When new blocks are added in an HTX message, if the first block position is not
defined, it is set. When the block pointed by it is removed, it is set to the
block following it. -1 remains the value to unset the position. the first block
position is unset when the HTX message is empty. It may also be unset on a
non-empty message, meaning every blocks were already analyzed.

From HTX analyzers point of view, this position is always set during headers
analysis. When they are waiting for a request or a response, if it is unset, it
means the analysis should wait. But once the analysis is started, and as long as
headers are not forwarded, it points to the message start-line.

As mentionned, outside the HTX analysis, no code must rely on the first block
position. So multiplexers and applets must always use the head position to start
a loop on an HTX message.
diff --git a/include/common/htx.h b/include/common/htx.h
index ec99098..25c28c8 100644
--- a/include/common/htx.h
+++ b/include/common/htx.h
@@ -161,7 +161,7 @@
 	uint64_t extra;  /* known bytes amount remaining to receive */
 	uint32_t flags;  /* HTX_FL_* */
 
-	int32_t sl_pos; /* position of the start-line of the HTTP message. -1 if unset */
+	int32_t  first;  /* position of the first block to (re)start the analyse. -1 if unset. */
 
 	struct htx_blk blocks[0]; /* Blocks representing the HTTP message itself */
 };
@@ -413,8 +413,8 @@
 	return (blk ? htx_get_blk_type(blk) : HTX_BLK_UNUSED);
 }
 
-/* Returns the position of the first block in the HTX message <htx>. It is the
- * sl_pos if set, otherwise it is the head.
+/* Returns the position of the first block in the HTX message <htx>. If unset,
+ * or if <htx> is empty, -1 is returned.
  *
  * An signed 32-bits integer is returned to handle -1 case. Blocks position are
  * store on unsigned 32-bits integer, but it is impossible to have so much
@@ -422,13 +422,13 @@
  */
 static inline int32_t htx_get_first(const struct htx *htx)
 {
-	if (htx->sl_pos != -1)
-		return htx->sl_pos;
-	return htx->head;
+	if (!htx->used)
+		return -1;
+	return htx->first;
 }
 
-/* Returns the first HTX block in the HTX message <htx>. If <blk> is the head,
- * NULL returned.
+/* Returns the first HTX block in the HTX message <htx>. If unset or if <htx> is
+ * empty, NULL returned.
  */
 static inline struct htx_blk *htx_get_first_blk(const struct htx *htx)
 {
@@ -717,7 +717,7 @@
 	htx->data = htx->used = htx->tail = htx->head  = htx->front = 0;
 	htx->extra = 0;
 	htx->flags = HTX_FL_NONE;
-	htx->sl_pos = -1;
+	htx->first = -1;
 }
 
 /* returns the available room for raw data in buffer <buf> once HTX overhead is
@@ -832,8 +832,8 @@
 	fprintf(stderr, "htx:%p [ size=%u - data=%u - used=%u - wrap=%s - extra=%llu]\n",
 		htx, htx->size, htx->data, htx->used, (htx->tail >= htx->head) ? "NO" : "YES",
 		(unsigned long long)htx->extra);
-	fprintf(stderr, "\tsl_pos=%d - head=%u, tail=%u - front=%u\n",
-		htx->sl_pos, htx->head, htx->tail, htx->front);
+	fprintf(stderr, "\tfirst=%d - head=%u, tail=%u - front=%u\n",
+		htx->first, htx->head, htx->tail, htx->front);
 
 	for (pos = htx_get_head(htx); pos != -1; pos = htx_get_next(htx, pos)) {
 		struct htx_sl     *sl;