MINOR: proto-http: Add sample fetch wich returns all HTTP headers

The sample fetch returns all headers including the last jump line.
The last jump line is used to determine if the block of headers is
truncated or not.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index 1cb9b63..bfce6b1 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -14167,6 +14167,12 @@
   (eg: "stick on", "stick match"), and for "res.payload_lv" when used in the
   context of a response such as in "stick store response".
 
+req.hdrs : string
+  Returns the current request headers as string including the last empty line
+  separating headers from the request body. The last empty line can be used to
+  detect a truncated header block. This sample fetch is useful for some SPOE
+  headers analyzers and for advanced logging.
+
 req.hdrs_bin : binary
   Returns the current request headers contained in preparsed binary form. This
   is useful for offloading some processing with SPOE. Each string is described
diff --git a/src/proto_http.c b/src/proto_http.c
index 2dd2ad4..579473b 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -10437,6 +10437,31 @@
 	return 1;
 }
 
+/* Returns a string block containing all headers including the
+ * empty line wich separes headers from the body. This is useful
+ * form some headers analysis.
+ */
+static int
+smp_fetch_hdrs(const struct arg *args, struct sample *smp, const char *kw, void *private)
+{
+	struct http_msg *msg;
+	struct hdr_idx *idx;
+	struct http_txn *txn;
+
+	CHECK_HTTP_MESSAGE_FIRST();
+
+	txn = smp->strm->txn;
+	idx = &txn->hdr_idx;
+	msg = &txn->req;
+
+	smp->data.type = SMP_T_STR;
+	smp->data.u.str.str = msg->chn->buf->p + hdr_idx_first_pos(idx);
+	smp->data.u.str.len = msg->eoh - hdr_idx_first_pos(idx) + 1 +
+	                      (msg->chn->buf->p[msg->eoh] == '\r');
+
+	return 1;
+}
+
 /* Returns the header request in a length/value encoded format.
  * This is useful for exchanges with the SPOE.
  *
@@ -13457,6 +13482,7 @@
 	{ "req.body_size",   smp_fetch_body_size,      0,                NULL,    SMP_T_SINT, SMP_USE_HRQHV },
 	{ "req.body_param",  smp_fetch_body_param,     ARG1(0,STR),      NULL,    SMP_T_BIN,  SMP_USE_HRQHV },
 
+	{ "req.hdrs",        smp_fetch_hdrs,           0,                NULL,    SMP_T_BIN,  SMP_USE_HRQHV },
 	{ "req.hdrs_bin",    smp_fetch_hdrs_bin,       0,                NULL,    SMP_T_BIN,  SMP_USE_HRQHV },
 
 	/* HTTP version on the response path */