]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: http: don't reject anymore message bodies not containing the url param
authorWilly Tarreau <w@1wt.eu>
Thu, 10 Apr 2014 09:50:37 +0000 (11:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Apr 2014 21:15:27 +0000 (23:15 +0200)
http_process_request_body() currently expects a request body containing
exactly an expected message body. This was done in order to support load
balancing on a unique POST parameter but the way it's done still suffers
from some limitations. One of them is that there is no guarantee that the
accepted message will contain the appropriate string if it starts with
another parameter. But at the same time it will reject a message when the
buffer is full.

So as a first step, we don't reject anymore message bodies that fill the
buffer.

src/proto_http.c

index 3a4b0702ea9298f4b06137d546ecf06298f70a6f..51f97aa55dd358c25d4c267484813b3f8b4601ec 100644 (file)
@@ -4357,11 +4357,11 @@ int http_process_request_body(struct session *s, struct channel *req, int an_bit
                goto http_end;
 
  missing_data:
-       /* we get here if we need to wait for more data */
-       if (buffer_full(req->buf, global.tune.maxrewrite)) {
-               session_inc_http_err_ctr(s);
-               goto return_bad_req;
-       }
+       /* we get here if we need to wait for more data. If the buffer is full,
+        * we have the maximum we can expect.
+        */
+       if (buffer_full(req->buf, global.tune.maxrewrite))
+               goto http_end;
 
        if ((req->flags & CF_READ_TIMEOUT) || tick_is_expired(req->analyse_exp, now_ms)) {
                txn->status = 408;
@@ -4375,7 +4375,7 @@ int http_process_request_body(struct session *s, struct channel *req, int an_bit
        }
 
        /* we get here if we need to wait for more data */
-       if (!(req->flags & (CF_SHUTR | CF_READ_ERROR)) && !buffer_full(req->buf, global.tune.maxrewrite)) {
+       if (!(req->flags & (CF_SHUTR | CF_READ_ERROR))) {
                /* Not enough data. We'll re-use the http-request
                 * timeout here. Ideally, we should set the timeout
                 * relative to the accept() date. We just set the