MINOR: http-htx: Use http reply from the http-errors section

When an http reply is configured to use an error message from an http-errors
section, instead of referencing the error message, the http reply is used. To do
so the new http reply type HTTP_REPLY_INDIRECT has been added.
diff --git a/src/http_ana.c b/src/http_ana.c
index adadc18..6ff6ada 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -4708,7 +4708,18 @@
 	s->txn->status = reply->status;
 	channel_htx_truncate(res, htx);
 
-	/* HTTP_REPLY_ERRFILES unexpected here. handled as no payload if so */
+	/*
+	 * - HTTP_REPLY_ERRFILES unexpected here. handled as no payload if so
+	 *
+	 * - HTTP_REPLY_INDIRECT: switch on another reply if defined or handled
+	 *   as no payload if NULL. the TXN status code is set with the status
+	 *   of the original reply.
+	 */
+
+	if (reply->type == HTTP_REPLY_INDIRECT) {
+		if (reply->body.reply)
+			reply = reply->body.reply;
+	}
 
 	if (reply->type == HTTP_REPLY_ERRMSG) {
 		/* implicit or explicit error message*/
diff --git a/src/http_htx.c b/src/http_htx.c
index 18ac47c..cefd8f6 100644
--- a/src/http_htx.c
+++ b/src/http_htx.c
@@ -1278,10 +1278,10 @@
 
 	list_for_each_entry(http_errs, &http_errors_list, list) {
 		if (strcmp(http_errs->id, reply->body.http_errors) == 0) {
-			reply->type = HTTP_REPLY_ERRMSG;
+			reply->type = HTTP_REPLY_INDIRECT;
 			free(reply->body.http_errors);
-			reply->body.errmsg = http_errs->errmsg[http_get_status_idx(reply->status)];
-			if (!reply->body.errmsg)
+			reply->body.reply = http_errs->replies[http_get_status_idx(reply->status)];
+			if (!reply->body.reply)
 				ha_warning("Proxy '%s': status '%d' referenced by an http reply "
 					   "not declared in http-errors section '%s'.\n",
 					   px->id, reply->status, http_errs->id);