MINOR: htx: Add a function to copy a buffer in an HTX message

The htx_copy_msg() function can now be used to copy the HTX message stored in a
buffer in an existing HTX message. It takes care to not overwrite existing
data. If the destination message is empty, a raw copy is performed. All the
message is copied or nothing.

This function is used instead of channel_htx_copy_msg().
diff --git a/include/common/htx.h b/include/common/htx.h
index 7bd12b4..3d54c4a 100644
--- a/include/common/htx.h
+++ b/include/common/htx.h
@@ -780,6 +780,22 @@
 	return (htx->head != -1);
 }
 
+/* Copy an HTX message stored in the buffer <msg> to <htx>. We take care to
+ * not overwrite existing data. All the message is copied or nothing. It returns
+ * 1 on success and 0 on error.
+ */
+static inline int htx_copy_msg(struct htx *htx, const struct buffer *msg)
+{
+	/* The destination HTX message is empty, we can do a raw copy */
+	if (htx_is_empty(htx)) {
+		memcpy(htx, msg->area, msg->size);
+		return 1;
+	}
+
+	/* Otherwise, we need to append the HTX message */
+	return htx_append_msg(htx, htxbuf(msg));
+}
+
 /* Returns the number of used blocks in the HTX message <htx>. Note that it is
  * illegal to call this function with htx == NULL. Note also blocks of type
  * HTX_BLK_UNUSED are part of used blocks.