BUG/MEDIUM: spoe: arg len encoded in previous frag frame but len changed

Fragmented arg will do fetch at every encode time, each fetch may get
different result if SMP_F_MAY_CHANGE, for example res.payload, but
the length already encoded in first fragment of the frame, that will
cause SPOA decode failed and waste resources.

This patch must be backported to 1.9 and 1.8.
diff --git a/include/proto/spoe.h b/include/proto/spoe.h
index e5b3b4b..86328ad 100644
--- a/include/proto/spoe.h
+++ b/include/proto/spoe.h
@@ -121,7 +121,7 @@
  * many bytes has been encoded. If <*off> is zero at the end, it means that all
  * data has been encoded. */
 static inline int
-spoe_encode_data(struct sample *smp, unsigned int *off, char **buf, char *end)
+spoe_encode_data(unsigned int *len, struct sample *smp, unsigned int *off, char **buf, char *end)
 {
 	char *p = *buf;
 	int   ret;
@@ -185,15 +185,16 @@
 							      end);
 				if (ret == -1)
 					return -1;
+				*len = chk->data;
 			}
 			else {
 				/* The sample has been fragmented, encode remaining data */
-				ret = MIN(chk->data - *off, end - p);
+				ret = MIN(*len - *off, end - p);
 				memcpy(p, chk->area + *off, ret);
 				p += ret;
 			}
 			/* Now update <*off> */
-			if (ret + *off != chk->data)
+			if (ret + *off != *len)
 				*off += ret;
 			else
 				*off = 0;