MAJOR: http: move buffer->lr to http_msg->next

The buffer's pointer <lr> was only used by HTTP parsers which also use a
struct http_msg to keep track of the parser's state. We've reached a point
where it makes no sense to keep ->lr in the buffer, as the split between
buffer and msg is only arbitrary for historical reasons.

This change ensures that touching buffers will not impact HTTP messages
anymore, making the buffers more content-agnostic. However, it becomes
very important not to forget to update msg->next when some data get
forwarded or moved (and in general each time buf->p is updated).

The new pointer in http_msg becomes relative to buffer->p so that
parsing multiple messages becomes easier. It is possible that at one
point ->som and ->next will be merged.

Note: http_parse_reqline() and http_parse_stsline() have been temporarily
modified to know the message starting point in the buffer (->p).
diff --git a/include/proto/buffers.h b/include/proto/buffers.h
index 2b2b2ac..a95e5a1 100644
--- a/include/proto/buffers.h
+++ b/include/proto/buffers.h
@@ -62,7 +62,7 @@
 	buf->analysers = 0;
 	buf->cons = NULL;
 	buf->flags = BF_OUT_EMPTY;
-	buf->lr = buf->p = buf->data;
+	buf->p = buf->data;
 }
 
 /*****************************************************************/
@@ -317,7 +317,7 @@
 	buf->o = 0;
 	buf->i = 0;
 	buf->to_forward = 0;
-	buf->lr = buf->p = buf->data;
+	buf->p = buf->data;
 	buf->flags &= ~(BF_FULL | BF_OUT_EMPTY);
 	if (!buf->pipe)
 		buf->flags |= BF_OUT_EMPTY;
@@ -338,7 +338,6 @@
 		return;
 
 	buf->i = 0;
-	buf->lr = buf->p;
 	buf->flags &= ~BF_FULL;
 	if (buffer_len(buf) >= buffer_max_len(buf))
 		buf->flags |= BF_FULL;
@@ -442,7 +441,7 @@
 {
 	if (!(buf->i | buf->o)) {
 		/* let's realign the buffer to optimize I/O */
-		buf->p = buf->lr = buf->data;
+		buf->p = buf->data;
 	}
 	return buffer_contig_space(buf);
 }
@@ -457,7 +456,7 @@
 {
 	buf->o -= len;
 	if (buffer_len(buf) == 0)
-		buf->p = buf->lr = buf->data;
+		buf->p = buf->data;
 
 	if (buffer_len(buf) < buffer_max_len(buf))
 		buf->flags &= ~BF_FULL;
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index 0eed363..e7d1da6 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -113,6 +113,7 @@
 /* to be used when contents change in an HTTP message */
 #define http_msg_move_end(msg, bytes) do { \
 		unsigned int _bytes = (bytes);	\
+		(msg)->next += (_bytes);	\
 		(msg)->col += (_bytes);		\
 		(msg)->sov += (_bytes);		\
 		(msg)->eoh += (_bytes);		\
diff --git a/include/types/buffers.h b/include/types/buffers.h
index 5925455..ab56129 100644
--- a/include/types/buffers.h
+++ b/include/types/buffers.h
@@ -180,7 +180,6 @@
 	int wex;                        /* expiration date for a write or connect, in ticks */
 	int rto;                        /* read timeout, in ticks */
 	int wto;                        /* write timeout, in ticks */
-	char *lr;                       /* last read read */
 	char *p;                        /* buffer's start pointer, separates in and out data */
 	unsigned int size;              /* buffer size in bytes */
 	unsigned int i;                 /* number of input bytes pending for analysis in the buffer */
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index 463149a..02468fa 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -304,6 +304,7 @@
 struct http_msg {
 	unsigned int msg_state;                /* where we are in the current message parsing */
 	unsigned int flags;                    /* flags describing the message (HTTP version, ...) */
+	unsigned int next;                     /* pointer to next byte to parse, relative to buf->p */
 	unsigned int col, sov;                 /* current header: colon, start of value */
 	unsigned int eoh;                      /* End Of Headers, relative to buffer */
 	char *sol;                             /* start of line, also start of message when fully parsed */