[MAJOR] buffers: automatically compute the maximum buffer length

We used to apply a limit to each buffer's size in order to leave
some room to rewrite headers, then we used to remove this limit
once the session switched to a data state.

Proceeding that way becomes a problem with keepalive because we
have to know when to stop reading too much data into the buffer
so that we can leave some room again to process next requests.

The principle we adopt here consists in only relying on to_forward+send_max.
Indeed, both of those data define how many bytes will leave the buffer.
So as long as their sum is larger than maxrewrite, we can safely
fill the buffers. If they are smaller, then we refrain from filling
the buffer. This means that we won't risk to fill buffers when
reading last data chunk followed by a POST request and its contents.

The only impact identified so far is that we must ensure that the
BF_FULL flag is correctly dropped when starting to forward. Right
now this is OK because nobody inflates to_forward without using
buffer_forward().
diff --git a/src/stream_sock.c b/src/stream_sock.c
index c1f0dfa..e75bdaf 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -302,15 +302,15 @@
 		if (b->l == 0) {
 			/* let's realign the buffer to optimize I/O */
 			b->r = b->w = b->lr = b->data;
-			max = b->max_len;
+			max = buffer_max_len(b);
 		}
 		else if (b->r > b->w) {
-			max = b->data + b->max_len - b->r;
+			max = b->data + buffer_max_len(b) - b->r;
 		}
 		else {
 			max = b->w - b->r;
-			if (max > b->max_len)
-				max = b->max_len;
+			if (max > buffer_max_len(b))
+				max = buffer_max_len(b);
 		}
 
 		if (max == 0) {
@@ -363,7 +363,7 @@
 
 			b->total += ret;
 
-			if (b->l >= b->max_len) {
+			if (b->l >= buffer_max_len(b)) {
 				/* The buffer is now full, there's no point in going through
 				 * the loop again.
 				 */
@@ -642,7 +642,7 @@
 				b->w = b->data; /* wrap around the buffer */
 
 			b->l -= ret;
-			if (likely(b->l < b->max_len))
+			if (likely(b->l < buffer_max_len(b)))
 				b->flags &= ~BF_FULL;
 
 			if (likely(!b->l))