MEDIUM: http: small helpers to compute how far to rewind to find BODY and DATA

http_body_rewind() returns the number of bytes to rewind before buf->p to
find the message's body. It relies on http_hdr_rewind() to find the beginning
and adds msg->eoh + msg->eol which are always safe.

http_data_rewind() does the same to get the beginning of the data, which
differs from above when a chunk is present. It uses the function above and
adds msg->sol.

The purpose is to centralize further ->sov changes aiming at avoiding
to rely on buf->o.
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index aa2c901..53f0eca 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -149,6 +149,27 @@
 	return http_hdr_rewind(msg) - msg->sl.rq.u;
 }
 
+/* Return the amount of bytes that need to be rewound before buf->p to access
+ * the current message's BODY. The purpose is to be able to easily fetch
+ * the message's beginning before headers are forwarded, as well as after.
+ */
+static inline int http_body_rewind(const struct http_msg *msg)
+{
+	return http_hdr_rewind(msg) - msg->eoh - msg->eol;
+}
+
+/* Return the amount of bytes that need to be rewound before buf->p to access
+ * the current message's DATA. The difference with the function above is that
+ * if a chunk is present and has already been parsed, its size is skipped so
+ * that the byte pointed to is the first byte of actual data. The function is
+ * safe for use in state HTTP_MSG_DATA regardless of whether the headers were
+ * already forwarded or not.
+ */
+static inline int http_data_rewind(const struct http_msg *msg)
+{
+	return http_body_rewind(msg) - msg->sol;
+}
+
 /* Return the maximum amount of bytes that may be read after the beginning of
  * the message body, according to the advertised length. The function is safe
  * for use between HTTP_MSG_BODY and HTTP_MSG_DATA regardless of whether the
diff --git a/src/backend.c b/src/backend.c
index 212e779..7d0be1b 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -299,7 +299,7 @@
 	struct proxy    *px   = s->be;
 	unsigned int     plen = px->url_param_len;
 	unsigned long    len  = http_body_bytes(msg);
-	const char      *params = b_ptr(req->buf, (int)(msg->sov + msg->sol - http_hdr_rewind(msg)));
+	const char      *params = b_ptr(req->buf, -http_data_rewind(msg));
 	const char      *p    = params;
 	const char      *start, *end;