]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[MAJOR] buffers: automatically compute the maximum buffer length
authorWilly Tarreau <w@1wt.eu>
Sun, 13 Dec 2009 14:53:05 +0000 (15:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Dec 2009 09:06:34 +0000 (10:06 +0100)
commit7c3c54177aa144711082d161fe125b2872c64d56
treea6e073211fa00e5c0085475f4bc48b0f66237ca2
parent9e13c3c6307efe824bfc8d7ed9592733fcbc3406
[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().
include/proto/buffers.h
include/types/buffers.h
src/buffers.c
src/client.c
src/proto_http.c
src/proto_tcp.c
src/session.c
src/stream_sock.c